agentroam-runtime-darwin-arm64 0.2.0-preview.75 → 0.2.0-preview.77
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/manifest.json +2 -2
- package/package.json +1 -1
- package/runtime/.next/BUILD_ID +1 -1
- package/runtime/.next/app-build-manifest.json +9 -9
- package/runtime/.next/app-path-routes-manifest.json +1 -1
- package/runtime/.next/build-manifest.json +5 -5
- package/runtime/.next/prerender-manifest.json +1 -1
- package/runtime/.next/required-server-files.json +1 -1
- package/runtime/.next/routes-manifest.json +1 -1
- package/runtime/.next/server/app/_not-found/page.js +1 -1
- package/runtime/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/runtime/.next/server/app/_not-found.html +1 -1
- package/runtime/.next/server/app/_not-found.rsc +1 -1
- package/runtime/.next/server/app/api/agent/abort/route.js +1 -1
- package/runtime/.next/server/app/api/agent/abort/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/agent/answer/route.js +1 -1
- package/runtime/.next/server/app/api/agent/answer/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/agent/codex-sharing/route.js +1 -1
- package/runtime/.next/server/app/api/agent/codex-sharing/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/agent/harness/status/route.js +1 -1
- package/runtime/.next/server/app/api/agent/harness/status/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/agent/model/route.js +1 -1
- package/runtime/.next/server/app/api/agent/model/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/agent/models/route.js +1 -1
- package/runtime/.next/server/app/api/agent/models/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/agent/run/route.js +1 -1
- package/runtime/.next/server/app/api/agent/run/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/agent/runtime-health/route.js +1 -1
- package/runtime/.next/server/app/api/agent/runtime-health/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/agent/steer/route.js +1 -1
- package/runtime/.next/server/app/api/agent/steer/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/agent/stream/route.js +4 -4
- package/runtime/.next/server/app/api/agent/stream/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/agent-workspaces/[workspaceId]/sessions/route.js +1 -1
- package/runtime/.next/server/app/api/agent-workspaces/[workspaceId]/sessions/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/agent-workspaces/route.js +1 -1
- package/runtime/.next/server/app/api/agent-workspaces/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/auth/verify/route.js +1 -1
- package/runtime/.next/server/app/api/business/route.js +1 -1
- package/runtime/.next/server/app/api/business/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/calendar/route.js +2 -3
- package/runtime/.next/server/app/api/calendar/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/client-logs/route.js +1 -1
- package/runtime/.next/server/app/api/collaboration/route.js +9 -9
- package/runtime/.next/server/app/api/collaboration/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/engine-threads/route.js +1 -1
- package/runtime/.next/server/app/api/engine-threads/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/engine-threads.body +1 -1
- package/runtime/.next/server/app/api/flow/v1/catalog/route.js +1 -1
- package/runtime/.next/server/app/api/flow/v1/catalog/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/flow/v1/runs/[runId]/cancel/route.js +1 -1
- package/runtime/.next/server/app/api/flow/v1/runs/[runId]/cancel/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/flow/v1/runs/[runId]/events/route.js +2 -2
- package/runtime/.next/server/app/api/flow/v1/runs/[runId]/events/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/flow/v1/runs/route.js +1 -1
- package/runtime/.next/server/app/api/flow/v1/runs/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/flow-studio/config/route.js +1 -1
- package/runtime/.next/server/app/api/internal/todo-bootstrap/route.js +1 -0
- package/runtime/.next/server/app/api/internal/todo-bootstrap/route.js.nft.json +1 -0
- package/runtime/.next/server/app/api/internal/todo-mcp/route.js +1 -0
- package/runtime/.next/server/app/api/internal/todo-mcp/route.js.nft.json +1 -0
- package/runtime/.next/server/app/api/mcp/connect/route.js +1 -1
- package/runtime/.next/server/app/api/mcp/disconnect/route.js +1 -1
- package/runtime/.next/server/app/api/mcp/servers/route.js +1 -1
- package/runtime/.next/server/app/api/mcp/servers.body +1 -1
- package/runtime/.next/server/app/api/memory/[key]/route.js +1 -1
- package/runtime/.next/server/app/api/memory/route.js +1 -1
- package/runtime/.next/server/app/api/messaging/route.js +1 -1
- package/runtime/.next/server/app/api/notifications/[id]/ack/route.js +1 -0
- package/runtime/.next/server/app/api/notifications/[id]/ack/route.js.nft.json +1 -0
- package/runtime/.next/server/app/api/notifications/[id]/route.js +1 -0
- package/runtime/.next/server/app/api/notifications/[id]/route.js.nft.json +1 -0
- package/runtime/.next/server/app/api/notifications/route.js +1 -0
- package/runtime/.next/server/app/api/notifications/route.js.nft.json +1 -0
- package/runtime/.next/server/app/api/notifications/stream/route.js +4 -0
- package/runtime/.next/server/app/api/notifications/stream/route.js.nft.json +1 -0
- package/runtime/.next/server/app/api/plugins/load/route.js +1 -1
- package/runtime/.next/server/app/api/plugins/load/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/projects/[id]/route.js +1 -1
- package/runtime/.next/server/app/api/projects/check/route.js +1 -1
- package/runtime/.next/server/app/api/projects/directories/route.js +1 -1
- package/runtime/.next/server/app/api/projects/roots/route.js +1 -1
- package/runtime/.next/server/app/api/projects/route.js +1 -1
- package/runtime/.next/server/app/api/push/subscribe/route.js +2 -2
- package/runtime/.next/server/app/api/push/subscribe/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/push/unsubscribe/route.js +2 -2
- package/runtime/.next/server/app/api/push/vapid/route.js +3 -3
- package/runtime/.next/server/app/api/push/vapid/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/push/vapid.body +1 -1
- package/runtime/.next/server/app/api/remote-tools/register/route.js +1 -1
- package/runtime/.next/server/app/api/remote-tools/register/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/session-images/[id]/route.js +1 -0
- package/runtime/.next/server/app/api/session-images/[id]/route.js.nft.json +1 -0
- package/runtime/.next/server/app/api/sessions/[id]/background-jobs/[jobId]/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/background-jobs/[jobId]/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/background-jobs/[jobId]/stop/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/background-jobs/[jobId]/stop/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/background-jobs/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/background-jobs/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/changes/route.js +3 -3
- package/runtime/.next/server/app/api/sessions/[id]/changes/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/engine-switches/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/engine-switches/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/fork/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/fork/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/fork-at/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/fork-at/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/goals/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/goals/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/handoff/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/handoff/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/native-goal/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/native-goal/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/query-index/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/query-index/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/release/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/release/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/switch-engine/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/switch-engine/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/thread-goal/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/thread-goal/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/thread-history/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/thread-history/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/tool-result/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/tool-result/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/sessions/parallel/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/parallel/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/sessions/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/settings/route.js +1 -1
- package/runtime/.next/server/app/api/skills/route.js +1 -1
- package/runtime/.next/server/app/api/todos/[id]/commands/route.js +1 -0
- package/runtime/.next/server/app/api/todos/[id]/commands/route.js.nft.json +1 -0
- package/runtime/.next/server/app/api/todos/[id]/executions/route.js +1 -0
- package/runtime/.next/server/app/api/todos/[id]/executions/route.js.nft.json +1 -0
- package/runtime/.next/server/app/api/todos/[id]/route.js +1 -0
- package/runtime/.next/server/app/api/todos/[id]/route.js.nft.json +1 -0
- package/runtime/.next/server/app/api/todos/route.js +1 -0
- package/runtime/.next/server/app/api/todos/route.js.nft.json +1 -0
- package/runtime/.next/server/app/api/tool-policies/[policyId]/route.js +1 -1
- package/runtime/.next/server/app/api/tool-policies/[policyId]/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/tool-policies/route.js +1 -1
- package/runtime/.next/server/app/api/tool-policies/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/tools/route.js +1 -1
- package/runtime/.next/server/app/api/tools/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/update/check/route.js +1 -1
- package/runtime/.next/server/app/api/update/install/route.js +1 -1
- package/runtime/.next/server/app/api/update/status/route.js +1 -1
- package/runtime/.next/server/app/api/web-auth/login/route.js +1 -1
- package/runtime/.next/server/app/api/web-auth/logout/route.js +1 -1
- package/runtime/.next/server/app/api/web-auth/revoke-all/route.js +1 -1
- package/runtime/.next/server/app/api/web-auth/setup/route.js +1 -1
- package/runtime/.next/server/app/api/web-auth/status/route.js +1 -1
- package/runtime/.next/server/app/api/web-console/bootstrap/route.js +1 -1
- package/runtime/.next/server/app/api/web-console/computer-settings/route.js +1 -1
- package/runtime/.next/server/app/api/web-console/computers/route.js +1 -1
- package/runtime/.next/server/app/api/web-console/device-state/route.js +1 -1
- package/runtime/.next/server/app/api/web-console/history/route.js +1 -1
- package/runtime/.next/server/app/api/web-console/preferences/route.js +1 -1
- package/runtime/.next/server/app/api/workspace-changes/route.js +1 -0
- package/runtime/.next/server/app/api/workspace-changes/route.js.nft.json +1 -0
- package/runtime/.next/server/app/web/page.js +4 -4
- package/runtime/.next/server/app/web/page_client-reference-manifest.js +1 -1
- package/runtime/.next/server/app-paths-manifest.json +45 -33
- package/runtime/.next/server/chunks/1298.js +1 -0
- package/runtime/.next/server/chunks/1973.js +1 -0
- package/runtime/.next/server/chunks/4621.js +1 -1
- package/runtime/.next/server/chunks/5303.js +1 -1
- package/runtime/.next/server/chunks/535.js +1 -0
- package/runtime/.next/server/chunks/5762.js +3 -3
- package/runtime/.next/server/chunks/5801.js +1 -0
- package/runtime/.next/server/chunks/5812.js +1 -0
- package/runtime/.next/server/chunks/685.js +1 -0
- package/runtime/.next/server/chunks/6977.js +1 -1
- package/runtime/.next/server/chunks/9119.js +15 -0
- package/runtime/.next/server/chunks/9457.js +1 -0
- package/runtime/.next/server/middleware-build-manifest.js +1 -1
- package/runtime/.next/server/pages/404.html +1 -1
- package/runtime/.next/server/pages/500.html +1 -1
- package/runtime/.next/server/server-reference-manifest.json +1 -1
- package/runtime/.next/static/chunks/753-90c7dd1ba08be9be.js +1 -0
- package/runtime/.next/static/chunks/app/web/{error-3cae58f0f14f0b4f.js → error-828d278147a0619d.js} +1 -1
- package/runtime/.next/static/chunks/app/web/layout-a8b7565989c1c063.js +1 -0
- package/runtime/.next/static/chunks/app/web/page-8ff95d45a0160843.js +1 -0
- package/runtime/.next/static/chunks/{main-d8ef9def37924b01.js → main-7240085c0ba42e9a.js} +1 -1
- package/runtime/.next/static/chunks/main-app-07d67f2d4e96ecb8.js +1 -0
- package/runtime/lib/desktop-discovery.mjs +12 -3
- package/runtime/lib/service-identity.mjs +17 -0
- package/runtime/native/Support.noindex/AgentRoam Remote Desktop.app/Contents/MacOS/agentroam-remote-desktop +0 -0
- package/runtime/native/Support.noindex/AgentRoam Remote Desktop.app/Contents/Resources/agentroam-component.json +1 -1
- package/runtime/native/Support.noindex/AgentRoam Remote Desktop.app/Contents/_CodeSignature/CodeResources +2 -2
- package/runtime/node_modules/.package-lock.json +17 -17
- package/runtime/node_modules/@agent/core/dist/index.js +865 -7
- package/runtime/node_modules/@agent/native-runtime/dist/index.js +28979 -9946
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/bridge.mjs +82 -90
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/browser-sdk.js +65 -64
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-0vfvgmex.mjs +39 -0
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-x4kwpwv9.mjs → core-3h0s3zzg.mjs} +2 -2
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-ba5rrckm.mjs → core-6w7w19rc.mjs} +2 -2
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-8fprsbvz.mjs +42 -0
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-avz7wgsg.mjs +23 -0
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-b9ebje8h.mjs +20 -0
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-tf03rfab.mjs → core-e1h3fbg3.mjs} +3 -3
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-2h2qc9qv.mjs → core-ge6en8c9.mjs} +4 -4
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-h6r54bwv.mjs → core-htcq9qj1.mjs} +2 -2
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-sstebd83.mjs → core-nv0a4kre.mjs} +4 -4
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-y4qk5bdp.mjs +17 -0
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-qj4dtgyt.mjs → core-yrdmz7je.mjs} +3 -3
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-z276fcqp.mjs +28 -0
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core.mjs +12 -11
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/manifest.json +22 -22
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/manifest.zst.json +26 -26
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/package.json +23 -25
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs +86 -90
- package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.cjs +72 -45
- package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.min.cjs +13 -13
- package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.min.mjs +13 -13
- package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.mjs +72 -45
- package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.node.cjs +72 -45
- package/runtime/node_modules/mediabunny/dist/modules/src/input.js +6 -0
- package/runtime/node_modules/mediabunny/dist/modules/src/media-sink.js +52 -35
- package/runtime/node_modules/mediabunny/dist/modules/src/media-source.js +2 -0
- package/runtime/node_modules/mediabunny/dist/modules/src/mpeg-ts/mpeg-ts-demuxer.js +7 -1
- package/runtime/node_modules/mediabunny/dist/modules/src/source.js +7 -4
- package/runtime/node_modules/mediabunny/dist/modules/src/tsconfig.tsbuildinfo +1 -1
- package/runtime/node_modules/mediabunny/dist/modules/src/version.js +1 -1
- package/runtime/node_modules/mediabunny/dist/modules/src/wave/wave-demuxer.js +6 -6
- package/runtime/node_modules/mediabunny/package.json +1 -1
- package/runtime/node_modules/mediabunny/src/input.ts +7 -0
- package/runtime/node_modules/mediabunny/src/media-sink.ts +56 -37
- package/runtime/node_modules/mediabunny/src/media-source.ts +3 -0
- package/runtime/node_modules/mediabunny/src/mpeg-ts/mpeg-ts-demuxer.ts +6 -1
- package/runtime/node_modules/mediabunny/src/source.ts +7 -4
- package/runtime/node_modules/mediabunny/src/version.ts +1 -1
- package/runtime/node_modules/mediabunny/src/wave/wave-demuxer.ts +6 -6
- package/runtime/node_modules/source-map-js/lib/quick-sort.js +92 -22
- package/runtime/node_modules/source-map-js/package.json +1 -1
- package/runtime/package-lock.json +41 -65
- package/runtime/server.js +1 -1
- package/runtime/webapp/dist/assets/AIHubView-CrtJMKfW.js +1 -0
- package/runtime/webapp/dist/assets/{AgentManager-CrN2B-tH.js → AgentManager-C2O-Dacy.js} +2 -2
- package/runtime/webapp/dist/assets/{AiHubPane-Du6ajSsx.js → AiHubPane-D2XWxc9R.js} +1 -1
- package/runtime/webapp/dist/assets/App-Bum2L4_E.js +63 -0
- package/runtime/webapp/dist/assets/App-CtLZIOFu.css +1 -0
- package/runtime/webapp/dist/assets/BrowserLivePanel-DkBugqrH.js +61 -0
- package/runtime/webapp/dist/assets/CalendarPage-DzYWlqoZ.js +1 -0
- package/runtime/webapp/dist/assets/CalendarView-BjjC_t12.css +1 -0
- package/runtime/webapp/dist/assets/CalendarView-HQls5G-1.js +31 -0
- package/runtime/webapp/dist/assets/CollaborationCreateDialog-BwiSJbjb.js +1 -0
- package/runtime/webapp/dist/assets/CollaborationDashboard-CNHt31kl.js +1 -0
- package/runtime/webapp/dist/assets/CollaborationPage-C4l-tTvn.js +6 -0
- package/runtime/webapp/dist/assets/{FilePreview-CevPpP6E.js → FilePreview-EGUAbGpH.js} +5 -5
- package/runtime/webapp/dist/assets/FileTree-aJGl1V0W.js +6 -0
- package/runtime/webapp/dist/assets/FileWorkspaceDrawer-zpD91eB6.js +1 -0
- package/runtime/webapp/dist/assets/FlowStudioPane-K1o4pSkZ.js +5 -0
- package/runtime/webapp/dist/assets/HostProjectPicker-BvboCQ0a.js +1 -0
- package/runtime/webapp/dist/assets/{LSPServerList-BMY6dFfG.js → LSPServerList-BSLzGLtW.js} +1 -1
- package/runtime/webapp/dist/assets/{MCPServerList-c91QNM-g.js → MCPServerList-CeWTI1-m.js} +1 -1
- package/runtime/webapp/dist/assets/{MemoryViewer-C9IfWwzW.js → MemoryViewer-YcceFawC.js} +1 -1
- package/runtime/webapp/dist/assets/NewSessionWindow-C_HCQQnW.js +1 -0
- package/runtime/webapp/dist/assets/NewSessionWindow-DOLG1XEp.css +1 -0
- package/runtime/webapp/dist/assets/{RemoteDesktopPage-w8aL061W.js → RemoteDesktopPage-Cpzv8zH0.js} +1 -1
- package/runtime/webapp/dist/assets/{RunningSessionsIcon-B8Cr2-hp.js → RunningSessionsIcon-DmCYwIYD.js} +5 -5
- package/runtime/webapp/dist/assets/SessionDashboard-C58Mke8a.js +16 -0
- package/runtime/webapp/dist/assets/{SessionDashboardBridge-Bx4EXtos.js → SessionDashboardBridge-BPsNDY5Y.js} +1 -1
- package/runtime/webapp/dist/assets/{SettingsPanel-CS4XL2sd.js → SettingsPanel-CPBIPT-Z.js} +2 -2
- package/runtime/webapp/dist/assets/{SkillManager-5FZnR9My.js → SkillManager-_qaGEuOE.js} +1 -1
- package/runtime/webapp/dist/assets/{TerminalPane-CRrbd0i4.js → TerminalPane-mYe76Pgb.js} +2 -2
- package/runtime/webapp/dist/assets/TodoPage-DdF5_SkL.js +1 -0
- package/runtime/webapp/dist/assets/{abnfDiagram-VCTEODGH-DBioGYiE.js → abnfDiagram-VCTEODGH-DLd8EeCY.js} +1 -1
- package/runtime/webapp/dist/assets/{arc-BRj_RXHL.js → arc-D4smlqs5.js} +1 -1
- package/runtime/webapp/dist/assets/{architectureDiagram-5GKGNRK7-CoCdq67U.js → architectureDiagram-5GKGNRK7-ByE3DRU4.js} +1 -1
- package/runtime/webapp/dist/assets/{arrow-right-Cqqb1zqH.js → arrow-right-BtIv2jiq.js} +1 -1
- package/runtime/webapp/dist/assets/artifact-links-4m1A00GO.js +2 -0
- package/runtime/webapp/dist/assets/{blockDiagram-I7D4REHJ-CLisIPjq.js → blockDiagram-I7D4REHJ-BvTUm5vA.js} +3 -3
- package/runtime/webapp/dist/assets/{c4Diagram-7LVT6UL2-BoLCIVW8.js → c4Diagram-7LVT6UL2-XKwj5RmQ.js} +1 -1
- package/runtime/webapp/dist/assets/calendar-days-BeI09qof.js +6 -0
- package/runtime/webapp/dist/assets/channel-wxCRUEc2.js +1 -0
- package/runtime/webapp/dist/assets/check-BdadwkYj.js +6 -0
- package/runtime/webapp/dist/assets/{chevron-down-DhZV290h.js → chevron-down-DwzPFeq8.js} +1 -1
- package/runtime/webapp/dist/assets/chevron-right-kcIXzCMb.js +6 -0
- package/runtime/webapp/dist/assets/{chunk-2Q5K7J3B-CIQxwzU0.js → chunk-2Q5K7J3B-7A6CDWIw.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-5VM5RSS4-Buiv0MCN.js → chunk-5VM5RSS4-mkNEWbY6.js} +1 -1
- package/runtime/webapp/dist/assets/chunk-F27PBJKO-DKG-1HL0.js +1 -0
- package/runtime/webapp/dist/assets/{chunk-IMKFNOWR-C0NrkJOc.js → chunk-IMKFNOWR-kiJDyKM7.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-JWPE2WC7-CGON_UvB.js → chunk-JWPE2WC7-DS7C5_M7.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-POPQ4Y6H-BXvOsc9g.js → chunk-POPQ4Y6H-DvgeK_lX.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-SVP7TREG-ZD_qn-NK.js → chunk-SVP7TREG-BLo_2ua-.js} +3 -3
- package/runtime/webapp/dist/assets/{chunk-TICWLB2K-DrB8f6RG.js → chunk-TICWLB2K-CJT6Qkz4.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-XXDRQBXY-CYgLMn5t.js → chunk-XXDRQBXY-D1OLqjNu.js} +1 -1
- package/runtime/webapp/dist/assets/classDiagram-ZZMXUADV-Ct3Cgqrl.js +1 -0
- package/runtime/webapp/dist/assets/classDiagram-v2-VYDZK3BY-Ct3Cgqrl.js +1 -0
- package/runtime/webapp/dist/assets/{codeSyntax-DfQ5rLir.js → codeSyntax-Dd0hAazb.js} +3 -3
- package/runtime/webapp/dist/assets/collaboration-CAgt9AiV.js +6 -0
- package/runtime/webapp/dist/assets/composer-file-routing-DSC2Eojr.js +6 -0
- package/runtime/webapp/dist/assets/{cose-bilkent-JH36ORCC-CDPnTlcy.js → cose-bilkent-JH36ORCC-CI6EKHP8.js} +1 -1
- package/runtime/webapp/dist/assets/{cynefin-OW5HDTMX-DDCxhkA5.js → cynefin-OW5HDTMX-CJTXYieX.js} +1 -1
- package/runtime/webapp/dist/assets/{cynefinDiagram-5FMLGOSQ-CIJ1KBPA.js → cynefinDiagram-5FMLGOSQ-CPl1UVhy.js} +2 -2
- package/runtime/webapp/dist/assets/{dagre-GXQ25YYZ-CFX8O3IJ.js → dagre-GXQ25YYZ-Dq3ZQGTN.js} +1 -1
- package/runtime/webapp/dist/assets/{diagram-S7CK7UJ4-B8UX2IBH.js → diagram-S7CK7UJ4-DJyU-2Di.js} +3 -3
- package/runtime/webapp/dist/assets/{diagram-UQ7AKVKN-Ce34DNrv.js → diagram-UQ7AKVKN-Csg8hC8m.js} +1 -1
- package/runtime/webapp/dist/assets/{diagram-VSXAHHWV-CVL_erWD.js → diagram-VSXAHHWV-B14uLH_N.js} +3 -3
- package/runtime/webapp/dist/assets/{diagram-VX7I27RA-DBFHI7Dk.js → diagram-VX7I27RA-D2Ww2nHe.js} +1 -1
- package/runtime/webapp/dist/assets/{diagram-Z3DM3KII-Bw_QcSQY.js → diagram-Z3DM3KII-D_YC6AVP.js} +2 -2
- package/runtime/webapp/dist/assets/{download-D3xZPWnZ.js → download-COWHIKec.js} +1 -1
- package/runtime/webapp/dist/assets/{ebnfDiagram-PWID7BFC-DRly04dj.js → ebnfDiagram-PWID7BFC-s66xVEGY.js} +1 -1
- package/runtime/webapp/dist/assets/{erDiagram-RLTQ6QDP-DTm817hG.js → erDiagram-RLTQ6QDP-CgZh5cEn.js} +1 -1
- package/runtime/webapp/dist/assets/{external-link-Cwu5rEgp.js → external-link-T3kil1jt.js} +1 -1
- package/runtime/webapp/dist/assets/{file-types-DKkhMnUV.js → file-types-0e-tNIVd.js} +2 -2
- package/runtime/webapp/dist/assets/{flowDiagram-HODETNUW-tc8ygZtG.js → flowDiagram-HODETNUW-BISMKynN.js} +1 -1
- package/runtime/webapp/dist/assets/{ganttDiagram-EL5Y4UJY-CsQFf1IN.js → ganttDiagram-EL5Y4UJY-Cbyu0NcF.js} +1 -1
- package/runtime/webapp/dist/assets/{gitGraphDiagram-WWUBYQGX-DAIxbmPX.js → gitGraphDiagram-WWUBYQGX-Cs6IQGBz.js} +7 -7
- package/runtime/webapp/dist/assets/history-Df4LXw6L.js +6 -0
- package/runtime/webapp/dist/assets/{image-plus-nplydLA5.js → image-plus-COHCHOpI.js} +1 -1
- package/runtime/webapp/dist/assets/index-CQTDnt74.css +1 -0
- package/runtime/webapp/dist/assets/index-CTJNAMck.js +489 -0
- package/runtime/webapp/dist/assets/{infoDiagram-27XIBGKW-CVcMW4UM.js → infoDiagram-27XIBGKW-4f3bFqNV.js} +1 -1
- package/runtime/webapp/dist/assets/{ishikawaDiagram-5VMMS53U-zzlEtZ1l.js → ishikawaDiagram-5VMMS53U-D-cJ9vio.js} +4 -4
- package/runtime/webapp/dist/assets/{journeyDiagram-3NMN7TZE-q7NuIMSl.js → journeyDiagram-3NMN7TZE-CeToS0Qx.js} +1 -1
- package/runtime/webapp/dist/assets/{kanban-definition-UXKFOSKX-DLYFZlKO.js → kanban-definition-UXKFOSKX-DStbIUk1.js} +7 -7
- package/runtime/webapp/dist/assets/{layout-PFWssIkE.js → layout-i2D4wlYd.js} +1 -1
- package/runtime/webapp/dist/assets/{linear-ZRVcojb1.js → linear-BcJhiCv3.js} +1 -1
- package/runtime/webapp/dist/assets/list-todo-7yETOqQe.js +6 -0
- package/runtime/webapp/dist/assets/{loader-circle-DIW9tlEz.js → loader-circle-CZdAfU-D.js} +1 -1
- package/runtime/webapp/dist/assets/locate-fixed-ByJuEKxC.js +6 -0
- package/runtime/webapp/dist/assets/{mermaid.core-C8Dl0Nah.js → mermaid.core-BjNFAB9I.js} +6 -6
- package/runtime/webapp/dist/assets/{mindmap-definition-YA3MSWOX-BcbqtwVk.js → mindmap-definition-YA3MSWOX-BUIHHUVG.js} +1 -1
- package/runtime/webapp/dist/assets/new-session-window-C7R76XMp.css +1 -0
- package/runtime/webapp/dist/assets/new-session-window-DwtkwFBQ.js +190 -0
- package/runtime/webapp/dist/assets/page-9-9EC7QM.js +86 -0
- package/runtime/webapp/dist/assets/pause-DXyBDZlg.js +6 -0
- package/runtime/webapp/dist/assets/{pegDiagram-XKGWAZYB-BQN3zQuy.js → pegDiagram-XKGWAZYB-BY5Bio5e.js} +1 -1
- package/runtime/webapp/dist/assets/{pieDiagram-E7YTZNPT-pOgxh3os.js → pieDiagram-E7YTZNPT-CF8DVW3F.js} +3 -3
- package/runtime/webapp/dist/assets/pin-2YlrlSJv.js +6 -0
- package/runtime/webapp/dist/assets/play-BxEpdvoI.js +6 -0
- package/runtime/webapp/dist/assets/{quadrantDiagram-AXDQQJYC-BOg7ujzG.js → quadrantDiagram-AXDQQJYC-CXWHO3a-.js} +1 -1
- package/runtime/webapp/dist/assets/{railroadDiagram-O6MQD6OU-CWsN3juJ.js → railroadDiagram-O6MQD6OU-C20JeJZ-.js} +1 -1
- package/runtime/webapp/dist/assets/{requirementDiagram-BXWQKSXE-B0yrO7Oy.js → requirementDiagram-BXWQKSXE-IYd9UrO9.js} +3 -3
- package/runtime/webapp/dist/assets/{rotate-ccw-O4wnfQP7.js → rotate-ccw-CFIRtbUD.js} +1 -1
- package/runtime/webapp/dist/assets/{rotate-cw-CCJtlAtB.js → rotate-cw-B_vFqNsz.js} +1 -1
- package/runtime/webapp/dist/assets/{sankeyDiagram-P5KCCOFB-5MS_e-3E.js → sankeyDiagram-P5KCCOFB-ysBhpblA.js} +2 -2
- package/runtime/webapp/dist/assets/{send-Cdg4ZVlp.js → send-DUE2vBoK.js} +1 -1
- package/runtime/webapp/dist/assets/{sequenceDiagram-WJ2MYXX4-C1w8qYSu.js → sequenceDiagram-WJ2MYXX4-CQMmk6cu.js} +4 -4
- package/runtime/webapp/dist/assets/session-dashboard-DnFhQhBN.js +1 -0
- package/runtime/webapp/dist/assets/{shield-check-CrjI2wPR.js → shield-check-Btyos6Iv.js} +1 -1
- package/runtime/webapp/dist/assets/{sizeCapture-INFHLROL-BonKTynC.js → sizeCapture-INFHLROL-DekvKUn1.js} +1 -1
- package/runtime/webapp/dist/assets/{stateDiagram-D77RDMKH-D3mn6ZK5.js → stateDiagram-D77RDMKH-Ds_FEmbr.js} +1 -1
- package/runtime/webapp/dist/assets/stateDiagram-v2-MP3YSRHH-DxJ1ks_8.js +1 -0
- package/runtime/webapp/dist/assets/{swimlanes-42K2YHIH-Bn9KWChU.js → swimlanes-42K2YHIH-cjPcEO_T.js} +1 -1
- package/runtime/webapp/dist/assets/swimlanesDiagram-VR7AAH4N-JGHIAQXy.js +8 -0
- package/runtime/webapp/dist/assets/{timeline-definition-24CTP7MA-BfuhI7EF.js → timeline-definition-24CTP7MA-CEOprVt5.js} +1 -1
- package/runtime/webapp/dist/assets/{trash-2-BrfgMjfL.js → trash-2-DLDxY6J7.js} +4 -9
- package/runtime/webapp/dist/assets/{types-VnQ_cKrp.js → types-CFAnlTif.js} +1 -1
- package/runtime/webapp/dist/assets/{vennDiagram-4TSXK5OY-CUFs5JyR.js → vennDiagram-4TSXK5OY-D82uxYY9.js} +5 -5
- package/runtime/webapp/dist/assets/{wardleyDiagram-VM6X3IG4-C27HHz1A.js → wardleyDiagram-VM6X3IG4-JFt7Izt0.js} +1 -1
- package/runtime/webapp/dist/assets/{web-CeCHmdwO.js → web-BMqaP0jw.js} +1 -1
- package/runtime/webapp/dist/assets/{web-BOzkL-0Z.js → web-Q9VPRftY.js} +1 -1
- package/runtime/webapp/dist/assets/{x-DP1nC4qG.js → x-CeSbythI.js} +1 -1
- package/runtime/webapp/dist/assets/{xychartDiagram-S5SC5T6Z-CQwRrSTf.js → xychartDiagram-S5SC5T6Z-1WCa4SfL.js} +3 -3
- package/runtime/webapp/dist/assets/zoom-out-CRr_o1NV.js +16 -0
- package/runtime/webapp/dist/index.html +2 -2
- package/runtime/ws-server.mjs +23 -4
- package/runtime/.next/server/chunks/1614.js +0 -1
- package/runtime/.next/server/chunks/732.js +0 -1
- package/runtime/.next/server/chunks/7519.js +0 -15
- package/runtime/.next/server/chunks/7788.js +0 -1
- package/runtime/.next/static/chunks/333-9881c3d2c558a28d.js +0 -1
- package/runtime/.next/static/chunks/app/web/layout-d5d7d1c5c74eef3c.js +0 -1
- package/runtime/.next/static/chunks/app/web/page-7afa4cb0119e90b7.js +0 -1
- package/runtime/.next/static/chunks/main-app-7a6902a607752446.js +0 -1
- package/runtime/lib/voice-tts-gateway.mjs +0 -96
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-9sxfsmzx.mjs +0 -18
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-dnsvg8nc.mjs +0 -53
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-k67vj6j9.mjs +0 -20
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-qbjntcdf.mjs +0 -18
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-rn7tc54w.mjs +0 -17
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-td7rt8zt.mjs +0 -17
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-y6bhrwmk.mjs +0 -47
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-ya1m7gzj.mjs +0 -18
- package/runtime/webapp/dist/assets/AIHubView-BMeOfqfm.js +0 -1
- package/runtime/webapp/dist/assets/App-CrZstnCH.css +0 -1
- package/runtime/webapp/dist/assets/App-zihaYk1L.js +0 -179
- package/runtime/webapp/dist/assets/BrowserLivePanel-CU_X6OU2.js +0 -56
- package/runtime/webapp/dist/assets/CollaborationCreateDialog-BmgYdwe7.js +0 -1
- package/runtime/webapp/dist/assets/CollaborationDashboard-mHU8iJYg.js +0 -1
- package/runtime/webapp/dist/assets/CollaborationPage-Br5fhNce.js +0 -6
- package/runtime/webapp/dist/assets/FileTree-CagcHV1N.js +0 -11
- package/runtime/webapp/dist/assets/FileWorkspaceDrawer-CWVndCXp.js +0 -1
- package/runtime/webapp/dist/assets/FlowStudioPane-BZA-qvBj.js +0 -5
- package/runtime/webapp/dist/assets/SessionDashboard-CFXXTm_4.js +0 -21
- package/runtime/webapp/dist/assets/artifact-links-73OZyi5W.js +0 -7
- package/runtime/webapp/dist/assets/channel-JGVZzkSo.js +0 -1
- package/runtime/webapp/dist/assets/chunk-F27PBJKO-XBMwIl6X.js +0 -1
- package/runtime/webapp/dist/assets/classDiagram-ZZMXUADV-BnctJ00R.js +0 -1
- package/runtime/webapp/dist/assets/classDiagram-v2-VYDZK3BY-BnctJ00R.js +0 -1
- package/runtime/webapp/dist/assets/collaboration-CQhzjwS_.js +0 -6
- package/runtime/webapp/dist/assets/composer-file-routing-D9orqwzY.js +0 -11
- package/runtime/webapp/dist/assets/index-B-d1Vs9E.css +0 -1
- package/runtime/webapp/dist/assets/index-DKm9ESDq.js +0 -489
- package/runtime/webapp/dist/assets/page-BG97oPXr.js +0 -91
- package/runtime/webapp/dist/assets/session-dashboard-BigU92sz.js +0 -6
- package/runtime/webapp/dist/assets/stateDiagram-v2-MP3YSRHH-WEfEW-mH.js +0 -1
- package/runtime/webapp/dist/assets/swimlanesDiagram-VR7AAH4N-D26_Nmko.js +0 -8
- package/runtime/webapp/dist/assets/zoom-out-Dg7YyzcP.js +0 -21
- package/runtime/webapp/dist/pcm-audio-worklet.js +0 -126
- /package/runtime/.next/static/{xuZ1UJWVNJ-rxb5YgETmd → alt-ud1W2PlWW6FLlkBcB}/_buildManifest.js +0 -0
- /package/runtime/.next/static/{xuZ1UJWVNJ-rxb5YgETmd → alt-ud1W2PlWW6FLlkBcB}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{c as Re,r as c,j as e,A as W,h as Ce,m as Ae,q as Le,u as Pe,e as xe,M as Oe,s as Fe}from"./index-CTJNAMck.js";import{r as Ie,p as Be}from"./artifact-links-4m1A00GO.js";import{i as _e,r as Ue,p as Ge,a as He,M as We,S as Ye}from"./composer-file-routing-DSC2Eojr.js";import{p as Ke}from"./SessionDashboardBridge-BPsNDY5Y.js";import{S as Ve}from"./shield-check-Btyos6Iv.js";import{A as Z,U as X,c as R,D as je}from"./collaboration-CAgt9AiV.js";import{X as Te}from"./x-CeSbythI.js";import{b as ie,C as Ze}from"./types-CFAnlTif.js";import{c as Je}from"./CollaborationTabBridge-Dxq4G1Uk.js";import{L as ve}from"./loader-circle-CZdAfU-D.js";import{H as Qe}from"./history-Df4LXw6L.js";import{I as Xe}from"./image-plus-COHCHOpI.js";import{C as et}from"./check-BdadwkYj.js";/**
|
|
2
|
+
* @license lucide-react v0.468.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const tt=Re("Clock3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]]),st=8;function nt(s,u){return s.split(/(\[[^\]\n]+\]\([^\n)]+\))/g).flatMap(r=>{const a=Ge(r),m=/^\[([^\]]+)\]\(([^)]+)\)$/.exec(r);if(!m||a.some(f=>f.type==="artifact"||f.type==="link"))return a;const p=m[2].trim().replace(/^<|>$/g,"");if(/^[A-Za-z][\w+.-]*:/.test(p)&&!/^[A-Za-z]:[\\/]/.test(p))return a;const n=Ie(p,u);return n?[{type:"artifact",label:m[1],path:n,raw:r}]:a})}function le({text:s,cwd:u}){const r=c.useId(),a=c.useRef(null),[m,p]=c.useState(!1),[n,f]=c.useState(!1);return c.useEffect(()=>{const o=a.current;if(!o)return;const l=()=>{const A=Number.parseFloat(getComputedStyle(o).lineHeight);p(o.scrollHeight>A*st+1)};l();const h=new ResizeObserver(l);return h.observe(o),()=>h.disconnect()},[s]),e.jsxs(e.Fragment,{children:[e.jsx("div",{id:r,ref:a,className:"collab-message-text","data-collapsed":!n,children:nt(s,u).map((o,l)=>{if(o.type==="text")return o.value;if(o.type==="code")return e.jsx("code",{children:o.value},l);if(o.type==="link")return e.jsx("a",{href:o.href,target:"_blank",rel:"noopener noreferrer",onClick:A=>{_e(A)&&Ue(o.href)&&A.preventDefault()},children:o.label},l);const h=Ie(o.path,u);return h?e.jsx("button",{type:"button",className:"collab-message-path",title:o.line?`${h}:${o.line}`:h,"aria-label":`查看文件:${o.label}`,onClick:()=>{Be(h)||window.agentApi.openExternal(/^https?:\/\//i.test(h)?h:`file://${h}`)},children:o.label},l):o.raw})}),m&&e.jsx("button",{type:"button",className:"collab-message-toggle","aria-expanded":n,"aria-controls":r,onClick:()=>f(o=>!o),children:n?"收起":"展开全文"})]})}function at({group:s}){var r;if(!((r=s.monitoring)!=null&&r.targets.length))return null;const u=s.members.find(a=>{var m;return a.id===((m=s.monitoring)==null?void 0:m.supervisorId)});return e.jsxs("div",{className:"collab-supervision-summary",children:[e.jsxs("div",{children:[e.jsx(Ve,{size:14}),e.jsxs("span",{children:[u?`监工 · ${u.name}`:"已关联"," · ",s.monitoring.targets.length," 条原始会话"]})]}),e.jsx("button",{onClick:()=>Ke({kind:"dashboard"}),children:"查看监工与决策"})]})}function ye(s,u,r){var f,o;const a=r==="sender"?s.senderAgentType:s.recipientAgentType;if(a)return a;const m=s[r];if(!m||m==="你"||m===u.name)return;const p=s.direction==="received"?"sender":s.direction==="sent"?"recipient":void 0;if(r===p){const l=((f=u.monitoring)==null?void 0:f.targets.filter(h=>(s.sessionId?h.id===s.sessionId:h.title===m)&&(m===s.sessionTitle||m===h.title)))??[];if(l.length===1)return l[0].agentType}const n=u.members.filter(l=>l.name===m);if(n.length===1)return n[0].agentType;if(m==="监工")return(o=u.members.find(l=>{var h;return l.id===((h=u.monitoring)==null?void 0:h.supervisorId)}))==null?void 0:o.agentType}function rt({message:s,group:u}){const r=ye(s,u,"sender"),a=ye(s,u,"recipient"),m=r?`${s.sender} · ${Z[r]}`:s.sender,p=a?`${s.recipient} · ${Z[a]}`:s.recipient,n=s.sender==="你"&&!r,f=s.direction==="received"?"收到消息":s.direction==="sent"?"发出消息":"监工动态";return e.jsxs("article",{className:`collab-message collab-supervision-message is-${s.direction}`,"data-supervision-message":s.id,"aria-label":`${f}:${s.title}`,children:[e.jsx("span",{className:`collab-avatar collab-supervision-avatar${n?" collab-avatar--user":""}`,role:"img","aria-label":m,title:m,children:r?e.jsx(W,{agentType:r,size:20}):n?"你":e.jsx(X,{size:18,"aria-hidden":"true"})}),e.jsxs("div",{className:"collab-message-body",children:[e.jsxs("div",{className:"collab-supervision-message-heading",children:[e.jsx("strong",{children:s.title}),e.jsx("span",{children:s.historical?"历史监工记录":f})]}),e.jsxs("div",{className:"collab-supervision-message-route","aria-label":`${s.sender}${s.recipient?` → ${s.recipient}`:""}`,children:[e.jsxs("span",{className:"collab-supervision-participant",title:m,children:[r&&e.jsx(W,{agentType:r,size:13}),e.jsx("span",{children:s.sender})]}),s.recipient&&e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":"true",children:"→"}),e.jsxs("span",{className:"collab-supervision-participant",title:p,children:[a&&e.jsx(W,{agentType:a,size:13}),e.jsx("span",{children:s.recipient})]})]})]}),s.sessionTitle&&e.jsxs("div",{className:"collab-supervision-message-source",title:s.sessionTitle,children:["来源会话:",s.sessionTitle]}),e.jsx(le,{text:s.content,cwd:s.cwd||u.cwd})]}),e.jsx("time",{dateTime:s.createdAt,title:new Date(s.createdAt).toLocaleString("zh-CN"),children:new Date(s.createdAt).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"})})]})}function we(s,u){return[...new Map([...s,...u].map(r=>[r.id,r])).values()].sort((r,a)=>r.createdAt.localeCompare(a.createdAt)||(r.sequence??0)-(a.sequence??0)||r.id.localeCompare(a.id))}function it(s,u){return[...s.filter(r=>r.kind!=="progress").map(r=>({kind:"discussion",message:r})),...u.map(r=>({kind:"supervision",message:r}))].sort((r,a)=>r.message.createdAt.localeCompare(a.message.createdAt)||(r.kind==="supervision"&&a.kind==="supervision"?(r.message.sequence??0)-(a.message.sequence??0):0)||r.message.id.localeCompare(a.message.id))}function lt(s){const u=Ce(),[r,a]=c.useState([]),[m,p]=c.useState(""),[n,f]=c.useState(!0),[o,l]=c.useState(!1),[h,A]=c.useState(null),k=c.useRef({groupId:s,generation:0,latest:0,before:null,loaded:!1,older:!1});c.useEffect(()=>{const i={groupId:s,generation:k.current.generation+1,latest:0,before:null,loaded:!1,older:!1};k.current=i,a([]),p(""),A(null),f(!0),l(!1)},[s]),c.useEffect(()=>{if(!u)return;const i=k.current;let v=!0,j=!1;const w=async()=>{if(!(j||!s||!Ae())){j=!0;try{const N=await R({action:"supervisionMessages",groupId:s,limit:100,...i.loaded?{afterSequence:i.latest}:{}});if(!v)return;a(z=>we(z,N.messages)),i.loaded||(i.before=N.nextBefore,A(N.nextBefore)),i.latest=Math.max(i.latest,N.latestSequence),i.loaded=!0,p("")}catch(N){v&&p(`监工消息加载失败:${N instanceof Error?N.message:String(N)}`)}finally{j=!1,v&&f(!1)}}};w();const D=setInterval(()=>{w()},2e3);return()=>{v=!1,clearInterval(D)}},[u,s]);const $=c.useCallback(async()=>{const i=k.current;if(!(i.groupId!==s||i.before===null||i.older)){i.older=!0,l(!0);try{const v=await R({action:"supervisionMessages",groupId:s,beforeSequence:i.before,limit:100});if(k.current!==i)return;a(j=>we(j,v.messages)),i.before=v.nextBefore,A(v.nextBefore),p("")}catch(v){k.current===i&&p(`历史监工消息加载失败:${v instanceof Error?v.message:String(v)}`)}finally{i.older=!1,k.current===i&&l(!1)}}},[s]);return{messages:r,error:m,loading:n,loadingOlder:o,hasOlder:h!==null,loadOlder:$}}function Ne({images:s,onPreview:u,onRemove:r}){return s.length?e.jsx("div",{className:`collab-images${r?" is-draft":""}`,"aria-label":r?"待发送图片":"消息图片",children:s.map((a,m)=>e.jsxs("div",{className:"collab-image",children:[e.jsx("button",{type:"button",className:"collab-image-preview","aria-label":`查看图片 ${m+1}`,onClick:()=>u(a),children:e.jsx("img",{src:a,alt:`图片 ${m+1}`,loading:"lazy"})}),r&&e.jsx("button",{type:"button",className:"collab-image-remove","aria-label":`移除图片 ${m+1}`,onClick:()=>r(m),children:e.jsx(Te,{size:13})})]},m))}):null}const Se=10,ot=20*1024*1024;function ct(s){if(s===void 0)return;if(!Array.isArray(s)||s.length>Se)throw new ie(`每条消息最多添加 ${Se} 张图片`);let u=0;for(const r of s){if(typeof r!="string"||!/^data:image\/(?:png|jpeg|gif|webp);base64,[A-Za-z0-9+/]+={0,2}$/.test(r))throw new ie("图片格式无效,仅支持 JPG、PNG、GIF 和 WebP");u+=r.length}if(u>ot)throw new ie("图片总大小超过限制,请减少图片或压缩后重试")}const Q={text:"",images:[]};function dt(s,u,r){const a=`${s}:${u||"new"}`,[m,p]=c.useState({}),[n,f]=c.useState({}),o=c.useRef(),l=m[a]??Q,h=$=>{p(i=>({...i,[a]:$(i[a]??Q)}))},A=async $=>{if($.length){f(i=>({...i,[a]:(i[a]??0)+1}));try{const i=await He($,async v=>{const j=await Le(v);return new Promise((w,D)=>{const N=new FileReader;N.onload=()=>w(String(N.result)),N.onerror=()=>D(new Error("无法读取图片")),N.readAsDataURL(j)})});(i.attachments.length||i.unsupportedImages.length||i.failedImages.length)&&r("无法添加部分图片,仅支持 JPG、PNG、GIF 和 WebP。"),i.images.length&&h(v=>({...v,images:[...v.images,...i.images]}))}catch(i){r(i instanceof Error?i.message:"无法添加图片")}finally{f(i=>({...i,[a]:Math.max(0,(i[a]??1)-1)}))}}},k=async $=>{var j;if(n[a]||!l.text.trim()&&!l.images.length)return!1;try{ct(l.images)}catch(w){return r(w instanceof Error?w.message:"图片无效"),!1}(((j=o.current)==null?void 0:j.key)!==a||o.current.draft!==l)&&(o.current={key:a,draft:l,id:crypto.randomUUID()});let i=a;return await $(l.text,o.current.id,l.images,w=>{var D;i=`${s}:${w}`,p(N=>({...N,[a]:Q,[i]:N[a]??l})),((D=o.current)==null?void 0:D.draft)===l&&(o.current.key=i)})?(p(w=>w[i]===l?{...w,[i]:Q}:w),!0):!1};return{draft:l.text,images:l.images,reading:!!n[a],addImages:A,submit:k,setDraft:$=>h(i=>({...i,text:$})),removeImage:$=>h(i=>({...i,images:i.images.filter((v,j)=>j!==$)}))}}function ut(s,u){const r=Ce(),[a,m]=c.useState(null),[p,n]=c.useState([]),[f,o]=c.useState(null),[l,h]=c.useState(null),[A,k]=c.useState(""),[$,i]=c.useState(!1),v=c.useRef(0),j=c.useRef(null),w=c.useRef(!1),D=c.useRef(null),N=()=>{v.current++,i(!0)},z=()=>{v.current--,i(v.current>0)},y=c.useRef({groupId:s,selected:f,revision:-1});y.current.groupId=s,y.current.selected=f;const O=c.useCallback(g=>{y.current.selected=g,y.current.revision=-1,o(g),h(null),k("");try{g&&localStorage.setItem(`collaboration:${s}:discussion`,g)}catch{}},[s]),P=c.useCallback(async()=>{const g=await R({action:"discussions",groupId:s});return y.current.groupId===s&&n(g),g},[s]);c.useEffect(()=>{let g=!0;return m(null),n([]),O(null),Promise.all([R({action:"group",groupId:s}),P()]).then(([x,E])=>{var C,T;if(!g)return;m(x);let I=null;try{I=localStorage.getItem(`collaboration:${s}:discussion`)}catch{}I=u||new URLSearchParams(window.location.search).get("discussionId")||I,O(((C=E.find(q=>q.id===I))==null?void 0:C.id)||((T=E[0])==null?void 0:T.id)||null)}).catch(x=>{g&&k(x.message)}),()=>{g=!1}},[s,P,O,u]),c.useEffect(()=>{if(!r||!f)return;let g=!0,x=!1;const E=async()=>{if(!(x||!Ae())){x=!0;try{const C=await R({action:"discussion",discussionId:f,afterRevision:y.current.revision<0?void 0:y.current.revision});if(!g||y.current.selected!==f)return;if(!("unchanged"in C)&&C.revision>=y.current.revision&&(y.current.revision=C.revision,h(C),await P()),D.current){const T=D.current;k(q=>q===T?"":q),D.current=null}}catch(C){g&&(D.current=C instanceof Error?C.message:String(C),k(D.current))}finally{x=!1}}};E();const I=setInterval(()=>{E()},1200);return()=>{g=!1,clearInterval(I)}},[r,f,P]);const Y=()=>(j.current||(N(),j.current=(async()=>{const g=await R({action:"createDiscussion",groupId:s});return y.current.groupId!==s?null:(O(g.id),y.current.revision=g.revision,h(g),await P(),g)})().finally(()=>{j.current=null,z()})),j.current),F=async g=>{if(!(!r||!f)){N();try{const x=await R({action:g,discussionId:f});y.current.selected===f&&x.revision>=y.current.revision&&(y.current.revision=x.revision,h(x))}catch(x){k(x instanceof Error?x.message:String(x))}finally{z()}}},K=async g=>{if(!(!f||(l==null?void 0:l.mode)===g)){N();try{const x=await R({action:"setMode",discussionId:f,mode:g});y.current.selected===f&&x.revision>=y.current.revision&&(y.current.revision=x.revision,h(x))}catch(x){k(x instanceof Error?x.message:String(x))}finally{z()}}},ee=async(g,x,E,I)=>{var C;if(w.current)return!1;w.current=!0,N(),k("");try{const T=f||((C=await Y())==null?void 0:C.id);if(!T)return!1;f||I==null||I(T);const q=await R({action:"send",discussionId:T,text:g,messageId:x,...E!=null&&E.length?{images:E}:{}});return y.current.selected===T&&q.revision>=y.current.revision&&(y.current.revision=q.revision,h(q)),await P(),!0}catch(T){return k(T instanceof Error?T.message:String(T)),!1}finally{w.current=!1,z()}},J=async(g,x)=>{const E=await R({action:"updateRole",groupId:s,memberId:g,role:x});y.current.groupId===s&&m(E)};return{group:l!=null&&l.groupSnapshot&&a?{...l.groupSnapshot,name:a.name}:a,history:p,selected:f,discussion:l,error:A,busy:$,select:O,create:Y,act:F,setMode:K,send:ee,setError:k,updateRole:J}}function ke({member:s,isUser:u=!1,isOwner:r=!1}){const a=u?"你":s?`${s.name} · ${Z[s.agentType]}${r?" · 群主":""}`:"协作动态";return e.jsxs("span",{className:`collab-avatar${u?" collab-avatar--user":""}`,role:"img","aria-label":a,title:a,children:[u?"你":s?e.jsx(W,{agentType:s.agentType,size:20}):e.jsx(X,{size:18,"aria-hidden":"true"}),r&&e.jsx(Ze,{className:"collab-avatar-crown",size:13,"aria-hidden":"true"})]})}function ft({message:s,discussionId:u,onError:r}){var o;const[a,m]=c.useState(""),[p,n]=c.useState(!1);if(!s.question||s.question.resolved)return e.jsxs("span",{className:"collab-muted",children:[e.jsx(et,{size:12})," 已处理"]});const f=async(l,h)=>{n(!0);try{await R({action:"answer",discussionId:u,questionId:s.question.id,answer:l,...h===void 0?{}:{selectedIndices:[h]}})}catch(A){r(A instanceof Error?A.message:String(A))}finally{n(!1)}};return e.jsxs("div",{className:"collab-question",children:[(o=s.question.options)==null?void 0:o.map((l,h)=>e.jsx("button",{disabled:p,onClick:()=>{f(l.label,h)},title:l.description,children:l.label},h)),e.jsxs("form",{onSubmit:l=>{l.preventDefault(),a.trim()&&f(a)},children:[e.jsx("input",{"aria-label":"回答成员问题",value:a,onChange:l=>m(l.target.value),placeholder:"输入回复"}),e.jsx("button",{disabled:p||!a.trim(),children:"回复"})]})]})}function At({groupId:s,initialDiscussionId:u}){var pe,ge;const r=s||new URLSearchParams(location.search).get("groupId")||"",{group:a,history:m,selected:p,discussion:n,error:f,busy:o,select:l,create:h,act:A,setMode:k,send:$,setError:i,updateRole:v}=ut(r,u),j=lt(r),{draft:w,setDraft:D,images:N,reading:z,addImages:y,removeImage:O,submit:P}=dt(r,p,i),[Y,F]=c.useState(!1),[K,ee]=c.useState(null),[J,g]=c.useState(null),x=c.useRef(null),E=c.useRef(null),[I,C]=c.useState(null),[T,q]=c.useState(0),oe=Pe(t=>t.skin);c.useEffect(()=>{document.documentElement.setAttribute("data-skin",oe)},[oe]);const ce=!!f||!!a&&(!p||!!n);c.useEffect(()=>{ce&&window.parent!==window&&window.parent.postMessage({type:Je,groupId:r},window.location.origin)},[ce,r]);const de=c.useRef(null),te=c.useRef(null),G=c.useRef(!0);if(c.useEffect(()=>{var t;G.current&&((t=de.current)==null||t.scrollIntoView({block:"end"}))},[n==null?void 0:n.messages.length,j.messages.length,p]),c.useEffect(()=>{G.current=!0},[p]),!a)return e.jsx("div",{className:"collab-loading",children:f?e.jsx("p",{role:"alert",children:f}):e.jsxs(e.Fragment,{children:[e.jsx(ve,{className:"collab-spin"}),"正在打开协作群…"]})});const L=a.members.find(t=>t.id===a.ownerId),B=((n==null?void 0:n.mode)??"task-graph")==="chat",_=I?a.members.filter(t=>`${t.name} ${t.id}`.toLowerCase().includes(I.query.toLowerCase())):[],$e=(t,d)=>{const S=/(?:^|\s)@([^\s@]{0,30})$/.exec(t.slice(0,d));C(S?{query:S[1],start:d-S[1].length-1}:null),q(0)},ue=t=>{const d=E.current;if(!I||!d)return;const S=d.selectionStart??w.length,M=`@${t.name} `;D(w.slice(0,I.start)+M+w.slice(S)),C(null),requestAnimationFrame(()=>{d.focus();const U=I.start+M.length;d.setSelectionRange(U,U)})},V=(n==null?void 0:n.tasks.filter(t=>t.status==="running"))||[],se=(n==null?void 0:n.status)==="running"?n.tasks.filter(t=>t.status==="queued"):[],ne=se.filter(t=>t.result==="等待工作目录空闲"),ae=(n==null?void 0:n.planning)||(n==null?void 0:n.status)==="running"&&n.ownerPending&&V.length===0,H=!ae&&V.length===0&&se.length>0,Ee=ne.length>0?`${ne.length} 个任务等待工作目录空闲,空闲后会自动继续。`:"任务排队中,等待前置任务完成。",fe=H?ne.length>0?"等待工作目录空闲":"任务排队中":n?je[n.status]:"准备好了",re=it((n==null?void 0:n.messages)??[],j.messages),De=t=>{l(t),F(!1),C(null),G.current=!0},me=async()=>{var t;try{await h()&&(F(!1),C(null),(t=E.current)==null||t.focus())}catch(d){i(d instanceof Error?d.message:String(d))}},he=async()=>{o||z||await P($)&&(C(null),G.current=!0)};return e.jsxs("div",{className:"collab-page",children:[e.jsx(We,{image:J?{src:J,alt:"群聊图片"}:null,onClose:()=>g(null)}),Y&&e.jsx("button",{className:"collab-drawer-mask","aria-label":"关闭成员栏",onClick:()=>F(!1)}),e.jsxs("aside",{className:`collab-sidebar${Y?" is-open":""}`,children:[e.jsxs("header",{className:"collab-sidebar-heading",children:[e.jsx("div",{className:"collab-group-icon",children:e.jsx(X,{size:22})}),e.jsxs("div",{children:[e.jsxs("span",{className:"collab-eyebrow",children:["协作群 · ",a.members.length," 人"]}),e.jsx("h2",{children:a.name})]}),e.jsx("button",{className:"collab-mobile-close","aria-label":"收起群成员",onClick:()=>F(!1),children:e.jsx(Te,{size:18})})]}),e.jsxs("div",{className:"collab-roster","aria-label":"群成员",children:[e.jsx("span",{className:"collab-section-label",children:"群成员"}),[L,...a.members.filter(t=>t.id!==L.id)].map(t=>{var be;const d=V.find(b=>b.memberId===t.id),S=t.id===L.id&&(n==null?void 0:n.planning),M=se.find(b=>b.memberId===t.id),ze=(n==null?void 0:n.messages.some(b=>b.memberId===t.id&&b.question&&!b.question.resolved))?"等待你回复":S?"正在安排":d?"正在执行":M?M.result==="等待工作目录空闲"?"等待目录空闲":"排队中":"空闲";return e.jsxs("div",{className:`collab-roster-member${S||d?" is-working":""}`,children:[e.jsxs("button",{onClick:()=>ee(b=>b===t.id?null:t.id),"aria-expanded":K===t.id,children:[e.jsx(ke,{member:t,isOwner:t.id===L.id}),e.jsxs("span",{className:"collab-member-name",children:[e.jsx("strong",{children:t.name}),e.jsx("small",{children:Z[t.agentType]})]}),e.jsx("span",{className:"collab-member-status",children:ze})]}),e.jsx("p",{className:K===t.id?"is-expanded":void 0,children:t.role||(n==null?void 0:n.roles[t.id])||"等待群主分配定位"}),K===t.id&&e.jsxs("div",{className:"collab-member-detail",children:[e.jsx("small",{children:((be=t.model)==null?void 0:be.id)||"默认模型"}),e.jsxs("form",{className:"collab-role-form",onSubmit:b=>{b.preventDefault();const qe=new FormData(b.currentTarget).get("role");v(t.id,String(qe||"")).catch(Me=>i(Me.message))},children:[e.jsxs("label",{children:["定位与职责",e.jsx("textarea",{name:"role",defaultValue:t.role,rows:3,maxLength:8e3,placeholder:"留空由群主分配"},t.role)]}),e.jsx("button",{type:"submit",children:"保存职责"})]}),n==null?void 0:n.tasks.filter(b=>b.memberId===t.id).map(b=>e.jsxs("div",{children:[b.title,e.jsx("span",{children:b.status==="completed"?"已完成":b.status==="running"?"执行中":b.status==="queued"?"等待依赖或空闲":b.status==="failed"?"失败":b.status==="cancelled"?"已取消":"已中断"}),b.result&&e.jsxs("details",{children:[e.jsx("summary",{children:"查看结果"}),e.jsx(le,{text:b.result,cwd:b.cwd||a.cwd})]})]},b.id)),n==null?void 0:n.messages.filter(b=>b.memberId===t.id&&b.kind==="progress").slice(-20).map(b=>e.jsx("small",{children:b.content},b.id))]})]},t.id)})]}),e.jsxs("section",{className:"collab-history","aria-label":"群聊记录",children:[e.jsxs("header",{children:[e.jsxs("span",{className:"collab-section-label",children:[e.jsx(Qe,{size:13}),"群聊记录"]}),e.jsx("button",{disabled:o,"aria-label":"新建群讨论",title:"新讨论",onClick:()=>{me()},children:e.jsx(xe,{size:17})})]}),e.jsx("div",{className:"collab-history-list",children:m.length?m.map(t=>e.jsxs("button",{className:p===t.id?"is-selected":"","aria-current":p===t.id?"page":void 0,onClick:()=>{De(t.id)},children:[e.jsx("strong",{children:t.title}),e.jsxs("span",{children:[e.jsx("time",{children:new Date(t.updatedAt).toLocaleDateString("zh-CN",{month:"short",day:"numeric"})}),e.jsx("small",{children:je[t.status]})]})]},t.id)):e.jsx("p",{className:"collab-muted",children:(pe=a.monitoring)!=null&&pe.targets.length?"监工动态持续保存在群内,普通讨论会列在这里。":"发送第一条任务,记录会保存在这里。"})})]}),e.jsxs("footer",{className:"collab-sidebar-footer",title:a.cwd,children:[e.jsx(at,{group:a}),a.cwd]})]}),e.jsxs("main",{className:"collab-conversation",children:[e.jsxs("header",{className:"collab-conversation-heading",children:[e.jsx("button",{className:"collab-mobile-menu","aria-label":"展开群成员和群聊记录",onClick:()=>F(!0),children:e.jsx(Oe,{size:20})}),e.jsxs("div",{className:"collab-discussion-title",children:[e.jsx("h1",{children:(n==null?void 0:n.title)||((ge=a.monitoring)!=null&&ge.targets.length?"监工动态":"开始一起做事")}),e.jsx("span",{className:"collab-discussion-status","data-status":H?"queued":(n==null?void 0:n.status)||"idle",role:"status","aria-label":fe,title:fe})]}),e.jsxs("div",{className:"collab-heading-actions",children:[n&&e.jsxs("div",{className:"collab-mode-toggle",role:"group","aria-label":"讨论模式",children:[e.jsx("button",{"aria-pressed":!B,disabled:o||!B,title:"每条消息交给群主安排;@成员 仍直接指派",onClick:()=>{k("task-graph")},children:"编排"}),e.jsx("button",{"aria-pressed":B,disabled:o||B,title:"@成员直接指派 · @群主安排分工 · 无 @ 静默",onClick:()=>{k("chat")},children:"@直聊"})]}),n&&["running","waiting"].includes(n.status)&&e.jsx("button",{className:"collab-heading-stop",disabled:o,onClick:()=>{A("stop")},children:e.jsxs("span",{className:"collab-heading-action-content",children:[e.jsx(Ye,{size:12,fill:"currentColor",strokeWidth:0}),"停止"]})}),n&&["waiting","interrupted","stopped"].includes(n.status)&&e.jsx("button",{className:"collab-heading-resume",disabled:o,onClick:()=>{A("resume")},children:e.jsx("span",{className:"collab-heading-action-content",children:"继续协作"})}),e.jsx("button",{className:"collab-heading-new",disabled:o,onClick:()=>{me()},children:e.jsxs("span",{className:"collab-heading-action-content",children:[e.jsx(xe,{size:14}),"新讨论"]})})]})]}),e.jsxs("div",{ref:te,className:"collab-messages",onScroll:()=>{const t=te.current;t&&(G.current=t.scrollHeight-t.scrollTop-t.clientHeight<120)},children:[j.error&&e.jsx("p",{className:"collab-error",role:"alert",children:j.error}),j.hasOlder&&e.jsx("button",{className:"collab-supervision-load",disabled:j.loadingOlder,onClick:async()=>{G.current=!1;const t=te.current,d=(t==null?void 0:t.scrollHeight)??0;await j.loadOlder(),requestAnimationFrame(()=>{t&&(t.scrollTop+=t.scrollHeight-d)})},children:j.loadingOlder?"正在加载…":"查看更早的监工消息"}),j.loading&&!re.length&&e.jsx("p",{className:"collab-muted",role:"status",children:"正在加载群内消息…"}),!re.length&&!j.loading&&e.jsxs("div",{className:"collab-empty",children:[e.jsx("span",{className:"collab-empty-icon",children:e.jsx(X,{size:34})}),e.jsx("h2",{children:"把目标交给这个群。"}),e.jsx("p",{children:B?e.jsxs(e.Fragment,{children:["在群里 @ 成员直接做事,或 @群主 让它拆解安排。",e.jsx("br",{}),"没有 @ 的消息不会触发回应。"]}):e.jsxs(e.Fragment,{children:[L.name,"会安排分工,成员会在这里汇报进展。",e.jsx("br",{}),"@某位成员可直接指派;不 @ 则由",L.name,"安排。"]})}),e.jsx("div",{className:"collab-empty-members",children:a.members.map(t=>e.jsxs("span",{children:[e.jsx(W,{agentType:t.agentType,size:17}),t.name]},t.id))})]}),re.map(t=>{var M;if(t.kind==="supervision")return e.jsx(rt,{message:t.message,group:a},`supervision:${t.message.id}`);const d=t.message,S=a.members.find(U=>U.id===d.memberId);return e.jsxs("article",{className:`collab-message collab-message--${d.kind}`,children:[e.jsx(ke,{member:S,isUser:d.kind==="user",isOwner:d.kind!=="user"&&(S==null?void 0:S.id)===L.id}),e.jsxs("div",{className:"collab-message-body",children:[e.jsx(Ne,{images:d.images??[],onPreview:g}),e.jsx(le,{text:d.content,cwd:((M=n==null?void 0:n.tasks.find(U=>U.id===d.taskId))==null?void 0:M.cwd)||a.cwd}),d.kind==="question"&&p&&e.jsx(ft,{message:d,discussionId:p,onError:i})]}),e.jsx("time",{dateTime:d.createdAt,children:new Date(d.createdAt).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"})})]},`discussion:${d.id}`)}),(ae||V.length>0||H)&&e.jsxs("div",{className:`collab-live-status${H?" is-queued":""}`,role:"status",children:[H?e.jsx(tt,{size:14,"aria-hidden":"true"}):e.jsx(ve,{size:14,className:"collab-spin","aria-hidden":"true"}),e.jsx("span",{children:ae?`${L.name}正在安排下一步`:H?Ee:V.map(t=>{var d;return`${(d=a.members.find(S=>S.id===t.memberId))==null?void 0:d.name}:${t.title}`}).join(" · ")})]}),e.jsx("div",{ref:de})]}),e.jsxs("div",{className:"collab-composer-area",children:[f&&e.jsx("p",{className:"collab-error",role:"alert",children:f}),e.jsxs("div",{className:"collab-composer",children:[e.jsx(Ne,{images:N,onPreview:g,onRemove:O}),e.jsx("input",{ref:x,type:"file",accept:"image/png,image/jpeg,image/gif,image/webp",multiple:!0,hidden:!0,"aria-label":"选择群聊图片",onChange:t=>{const d=Array.from(t.target.files??[]);t.target.value="",y(d)}}),I&&_.length>0&&e.jsx("ul",{className:"collab-mention-list",role:"listbox","aria-label":"选择要提及的成员",children:_.map((t,d)=>e.jsx("li",{children:e.jsxs("button",{type:"button",role:"option","aria-selected":d===T,className:d===T?"is-active":"",title:t.id===L.id?"提及群主:触发一轮安排":`指派给 ${t.name}`,onMouseDown:S=>{S.preventDefault(),ue(t)},children:[e.jsx(W,{agentType:t.agentType,size:15}),e.jsx("span",{children:t.name}),e.jsx("small",{children:t.id===L.id?"群主 · 安排分工":Z[t.agentType]})]})},t.id))}),e.jsx("textarea",{ref:E,"aria-label":"发送群消息",value:w,placeholder:B?"@成员 或 @群主,说说要做什么…":"告诉群主,你想完成什么…",rows:3,onPaste:t=>{const d=Array.from(t.clipboardData.items).filter(S=>S.type.startsWith("image/")).flatMap(S=>{const M=S.getAsFile();return M?[M]:[]});d.length&&(t.preventDefault(),y(d))},onChange:t=>{D(t.target.value),$e(t.target.value,t.target.selectionStart??t.target.value.length)},onBlur:()=>C(null),onKeyDown:t=>{const d=_[T];if(I&&_.length>0&&d){if(t.key==="ArrowDown"||t.key==="ArrowUp"){t.preventDefault(),q(S=>t.key==="ArrowDown"?(S+1)%_.length:(S-1+_.length)%_.length);return}if(t.key==="Enter"||t.key==="Tab"){t.preventDefault(),ue(d);return}if(t.key==="Escape"){t.preventDefault(),C(null);return}}t.key==="Enter"&&!t.shiftKey&&!t.nativeEvent.isComposing&&(t.preventDefault(),he())}}),e.jsxs("footer",{children:[e.jsx("button",{type:"button",className:"collab-add-image","aria-label":"添加群聊图片",title:"添加图片",disabled:o||z,onClick:()=>{var t;return(t=x.current)==null?void 0:t.click()},children:e.jsx(Xe,{size:18})}),e.jsx("span",{children:z?"正在处理图片…":w.includes("@")?"@成员 直接指派,不打扰群主;@群主 触发一轮安排":B?"chat 模式:@成员 直接指派 · @群主 安排分工 · 无 @ 不会回应":(n==null?void 0:n.status)==="running"?"补充要求会交给群主继续安排":"由群主安排分工与并行"}),e.jsx("button",{"aria-label":"发送群消息",className:"collab-primary",disabled:o||z||!w.trim()&&!N.length||(n==null?void 0:n.status)==="stopping",onClick:()=>{he()},children:e.jsx(Fe,{size:20})})]})]}),e.jsx("small",{className:"collab-composer-hint",children:"Enter 发送 · Shift+Enter 换行 · 群聊记录自动保存"})]})]})]})}export{At as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./codeSyntax-
|
|
2
|
-
import{c as De,r,
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./codeSyntax-Dd0hAazb.js","./index-CTJNAMck.js","./index-CQTDnt74.css","./artifact-links-4m1A00GO.js","./rotate-ccw-CFIRtbUD.js","./loader-circle-CZdAfU-D.js","./trash-2-DLDxY6J7.js","./check-BdadwkYj.js","./download-COWHIKec.js","./x-CeSbythI.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{c as De,r,ac as _t,j as t,R as Te}from"./index-CTJNAMck.js";import{i as de}from"./artifact-links-4m1A00GO.js";import{R as Dt}from"./rotate-ccw-CFIRtbUD.js";import{L as Z}from"./loader-circle-CZdAfU-D.js";import{P as It}from"./trash-2-DLDxY6J7.js";import{C as rt}from"./check-BdadwkYj.js";import{D as Ht}from"./download-COWHIKec.js";import{X as Wt}from"./x-CeSbythI.js";/**
|
|
3
3
|
* @license lucide-react v0.468.0 - ISC
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the ISC license.
|
|
@@ -15,7 +15,7 @@ import{c as De,r,a7 as _t,j as t,R as Te}from"./index-DKm9ESDq.js";import{i as d
|
|
|
15
15
|
* This source code is licensed under the ISC license.
|
|
16
16
|
* See the LICENSE file in the root directory of this source tree.
|
|
17
17
|
*/const Ft=De("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),At=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/;function Ot(e){if(!e.trim())return{rows:[],added:0,removed:0};const n=[];let l=0,a=0,x=!1,g=0,c=0;for(const f of e.replace(/\n$/,"").split(`
|
|
18
|
-
`)){const k=f.match(At);if(k){l=Number(k[1]),a=Number(k[2]),x=!0,n.push({kind:"hunk",text:f,oldLine:null,newLine:null});continue}if(!x){!f.startsWith("diff --git ")&&!f.startsWith("index ")&&!f.startsWith("--- ")&&!f.startsWith("+++ ")&&n.push({kind:"meta",text:f,oldLine:null,newLine:null});continue}f.startsWith("+")?(n.push({kind:"added",text:f.slice(1),oldLine:null,newLine:a}),a+=1,g+=1):f.startsWith("-")?(n.push({kind:"removed",text:f.slice(1),oldLine:l,newLine:null}),l+=1,c+=1):f.startsWith(" ")?(n.push({kind:"context",text:f.slice(1),oldLine:l,newLine:a}),l+=1,a+=1):n.push({kind:"note",text:f,oldLine:null,newLine:null})}return{rows:n,added:g,removed:c}}const it=256*1024,
|
|
19
|
-
`);n[n.length-1]+=a[0];for(let x=1;x<a.length;x+=1)n.push(a[x])}return n}function $t({path:e,chunks:n,fileSize:l}){const[a,x]=r.useState(null),g=Ut(e),c=n.length>0&&g!==null&&(l===void 0||l<=it)&&n.reduce((y,u)=>y+u.length,0)<=it;r.useEffect(()=>{if(!c)return;let y=!1;return _t(async()=>{const{highlightCodeLines:u}=await import("./codeSyntax-
|
|
18
|
+
`)){const k=f.match(At);if(k){l=Number(k[1]),a=Number(k[2]),x=!0,n.push({kind:"hunk",text:f,oldLine:null,newLine:null});continue}if(!x){!f.startsWith("diff --git ")&&!f.startsWith("index ")&&!f.startsWith("--- ")&&!f.startsWith("+++ ")&&n.push({kind:"meta",text:f,oldLine:null,newLine:null});continue}f.startsWith("+")?(n.push({kind:"added",text:f.slice(1),oldLine:null,newLine:a}),a+=1,g+=1):f.startsWith("-")?(n.push({kind:"removed",text:f.slice(1),oldLine:l,newLine:null}),l+=1,c+=1):f.startsWith(" ")?(n.push({kind:"context",text:f.slice(1),oldLine:l,newLine:a}),l+=1,a+=1):n.push({kind:"note",text:f,oldLine:null,newLine:null})}return{rows:n,added:g,removed:c}}const it=256*1024,hn=16*1024,Bt={java:"java",js:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",ts:"typescript",tsx:"typescript",json:"json",py:"python",sh:"bash",bash:"bash",zsh:"bash",css:"css",scss:"scss",html:"xml",htm:"xml",xml:"xml",vue:"xml",svelte:"xml",astro:"xml",yml:"yaml",yaml:"yaml",toml:"ini",env:"ini",sql:"sql",c:"c",h:"c",cpp:"cpp",hpp:"cpp",go:"go",rs:"rust",kt:"kotlin",rb:"ruby",md:"markdown",markdown:"markdown",mdown:"markdown",mkdn:"markdown",mdx:"markdown",dockerfile:"dockerfile",gradle:"groovy",properties:"properties",graphql:"graphql",proto:"protobuf"};function Ut(e){var a;const n=((a=e.split(/[/\\]/).pop())==null?void 0:a.toLowerCase())??"";if(n==="dockerfile"||n.startsWith("dockerfile."))return"dockerfile";if(n===".env"||n.startsWith(".env."))return"ini";if(n===".bashrc"||n===".zshrc")return"bash";const l=n.includes(".")?n.slice(n.lastIndexOf(".")+1):"";return Bt[l]??null}function Xt(e){const n=[""];for(const l of e){const a=l.split(`
|
|
19
|
+
`);n[n.length-1]+=a[0];for(let x=1;x<a.length;x+=1)n.push(a[x])}return n}function $t({path:e,chunks:n,fileSize:l}){const[a,x]=r.useState(null),g=Ut(e),c=n.length>0&&g!==null&&(l===void 0||l<=it)&&n.reduce((y,u)=>y+u.length,0)<=it;r.useEffect(()=>{if(!c)return;let y=!1;return _t(async()=>{const{highlightCodeLines:u}=await import("./codeSyntax-Dd0hAazb.js");return{highlightCodeLines:u}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]),import.meta.url).then(({highlightCodeLines:u})=>{y||x(()=>u)}).catch(()=>{}),()=>{y=!0}},[c]);const f=r.useMemo(()=>Xt(n),[n]),k=r.useMemo(()=>c&&a?a(e,n.join("")):null,[n,c,a,e]);return t.jsx("code",{className:"file-code-preview","data-language":g??void 0,children:f.map((y,u)=>{const C=u<f.length-1?`
|
|
20
20
|
`:"";return t.jsxs(r.Fragment,{children:[t.jsx("span",{className:"file-code-line-number","aria-hidden":"true","data-line-number":u+1}),k?t.jsx("span",{className:"file-code-line-content",dangerouslySetInnerHTML:{__html:k[u]+C}}):t.jsxs("span",{className:"file-code-line-content",children:[y,C]})]},u)})})}const at=new Set(["ts","tsx","js","jsx","mjs","cjs","json","md","markdown","mdown","mkdn","mdx","css","scss","html","htm","xml","yml","yaml","toml","sh","zsh","bash","py","rb","go","rs","java","kt","c","h","cpp","hpp","sql","env","gitignore","dockerfile","txt","log","conf","properties","gradle","lock","csv","vue","svelte","astro","graphql","prisma","proto"]),qt=new Set(["png","jpg","jpeg","gif","webp","bmp","ico","svg"]),Gt=new Set(["html","htm"]),Yt=new Set(["md","markdown","mdown","mkdn","mdx"]),Vt=new Set(at),Jt="allow-scripts allow-popups allow-forms allow-modals",Qt=new Set(["mp4","webm","mov","m4v"]),Zt=new Set(["mp3","wav","m4a","aac","ogg","flac"]),Kt=new Set(["pdf"]),en=8*1024*1024,tn=4096,nn=512*1024,lt=256*1024*1024,rn={aac:"audio/aac",csv:"text/csv",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",gif:"image/gif",html:"text/html",jpeg:"image/jpeg",jpg:"image/jpeg",json:"application/json",m4a:"audio/mp4",m4v:"video/mp4",md:"text/markdown",mov:"video/quicktime",mp3:"audio/mpeg",mp4:"video/mp4",ogg:"audio/ogg",pdf:"application/pdf",png:"image/png",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",svg:"image/svg+xml",tar:"application/x-tar",txt:"text/plain",wav:"audio/wav",webm:"video/webm",webp:"image/webp",xls:"application/vnd.ms-excel",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xml:"application/xml",zip:"application/zip"};function ct(e,n){return n?!e.share||!e.canShare?"unsupported-browser":"ready":"insecure-context"}function dt(e){const n=ut(e);return rn[n]??"application/octet-stream"}function ut(e){var l;return((l=(de(e)?new URL(e).pathname:e).split(".").pop())==null?void 0:l.toLowerCase())??""}async function ft(e,n){var l;if(!n.share||!((l=n.canShare)!=null&&l.call(n,{files:[e]})))return"unsupported";try{return await n.share({files:[e],title:e.name}),"shared"}catch(a){if(a&&typeof a=="object"&&"name"in a&&a.name==="AbortError")return"cancelled";throw a}}function Ie(e){return Uint8Array.from(atob(e),n=>n.charCodeAt(0))}function mt(e,n,l){return e.decode(Ie(n),{stream:!l})}async function Me(e,n,l=()=>{},a=nn){const x=await n("fs:stat",{path:e});if(x.dir)throw new Error("文件夹不能下载");if(x.size>lt)throw new Error("文件超过 256M,请通过终端传输");const g=[];let c=0;do{const f=await n("fs:read",{path:e,offset:c,length:a},6e4),k=Ie(f.data);if(k.byteLength!==f.bytes)throw new Error("文件分块长度不一致,请重试");g.push(k.slice().buffer);const y=f.offset+f.bytes;if(!f.eof&&y<=c)throw new Error("文件下载未取得进展,请重试");if(c=y,l(x.size===0?100:Math.min(100,Math.round(c/x.size*100))),f.eof)break}while(c<x.size);return new Blob(g,{type:"application/octet-stream"})}function pt(e){var l;const n=((l=e.split(".").pop())==null?void 0:l.toLowerCase())??"";return Gt.has(n)}function xt(e){var l;const n=((l=e.split(".").pop())==null?void 0:l.toLowerCase())??"";return Yt.has(n)}function Re(e){var l;const n=((l=e.split(".").pop())==null?void 0:l.toLowerCase())??"";return Vt.has(n)}function ht(e){const n=ut(e);return at.has(n)||!e.includes(".")?"text":qt.has(n)?"image":Qt.has(n)?"video":Zt.has(n)?"audio":Kt.has(n)?"pdf":"hex"}function sn({path:e,gateway:n,onClose:l}){const a=n.request,[x,g]=r.useState([]),[c,f]=r.useState(null),[k,y]=r.useState(""),[u,C]=r.useState(null),[z,b]=r.useState("initial-loading"),[gt,He]=r.useState(!1),[We,K]=r.useState(0),[ue,fe]=r.useState(null),[S,T]=r.useState(null),[Pe,ee]=r.useState(null),[v,te]=r.useState(null),[bt,ne]=r.useState(!1),[Ne,I]=r.useState(null),[j,re]=r.useState(null),[vt,ie]=r.useState(!1),[me,pe]=r.useState(!0),[se,Fe]=r.useState(null),[Ae,xe]=r.useState("unavailable"),[he,ge]=r.useState(!1),[Oe,be]=r.useState(null),[F,ve]=r.useState("file"),[M,Be]=r.useState(!1),[Ue,we]=r.useState(!1),[ye,ke]=r.useState(!1),[w,O]=r.useState(!1),[L,A]=r.useState(""),[_,Xe]=r.useState(!1),[$e,H]=r.useState(null),[wt,B]=r.useState(!1),qe=r.useRef(null),Ge=r.useRef(null),oe=r.useRef(0),W=r.useRef(!1),p=r.useRef(0),U=r.useRef(!1),Se=r.useRef(new TextDecoder("utf-8",{fatal:!1})),je=r.useRef(null),X=r.useRef(null),Ee=r.useRef(!1),m=e?ht(e):"unsupported",Ce=e?de(e):!1,Ye=e?pt(e):!1,Ve=e?xt(e):!1,yt=Ye||Ve,Je=e?Re(e):!1,D=r.useMemo(()=>x.join(""),[x]),P=r.useCallback(()=>{const i=je.current;je.current=null,i&&a("fs:preview-close",{ticketId:i}).catch(()=>{})},[a]),$=r.useCallback(async(i,o=!1,s=p.current)=>{if(!U.current){U.current=!0,b(o?"initial-loading":"loading-more"),fe(null);try{const d=o?0:oe.current,h=await a("fs:read",{path:i,offset:d,length:256*1024});if(s!==p.current)return;const J=h.offset+h.bytes;if(!h.eof&&J<=d)throw new Error("文件加载未取得进展,请重试");o&&(Se.current=new TextDecoder("utf-8",{fatal:!1}));const le=mt(Se.current,h.data,h.eof);oe.current=J,pe(h.eof),K(J),g(E=>o?[le]:[...E,le]),C(E=>({size:h.size,mtime:(E==null?void 0:E.mtime)??0})),T(null),b("ready")}catch(d){if(s!==p.current)return;const h=d.message??String(d);o?(T(h),b("error")):(fe(h),b("ready"))}finally{s===p.current&&(U.current=!1)}}},[a]),Qe=r.useCallback(async(i,o)=>{try{const s=await a("fs:inspect-text-status",{path:i});if(o!==p.current)return;C({size:s.size,mtime:s.mtime}),xe(s.diffStatus),we(!s.tooLarge),B(!1),H(null)}catch{}},[a]),q=r.useCallback(async(i,o=p.current)=>{P(),b("initial-loading"),T(null);try{const s=await a("fs:preview-open",{path:i});if(o!==p.current){a("fs:preview-close",{ticketId:s.ticketId}).catch(()=>{});return}je.current=s.ticketId,X.current=s.url,f(s.url),C({size:s.size,mtime:s.mtime})}catch(s){if(o!==p.current)return;T(s.message??String(s)),b("error")}},[P,a]),Ze=r.useCallback(async(i,o=p.current)=>{b("initial-loading"),T(null);try{const s=await a("fs:read",{path:i,offset:0,length:tn});if(o!==p.current)return;kt(s.data),K(s.bytes),C(d=>({size:s.size,mtime:(d==null?void 0:d.mtime)??0})),b("ready")}catch(s){if(o!==p.current)return;T(s.message??String(s)),b("error")}},[a]);function kt(i){const o=atob(i),s=[];for(let d=0;d+16<=o.length||d===0;d+=16){const h=o.slice(d,d+16),J=[...h].map(E=>E.charCodeAt(0).toString(16).padStart(2,"0")).join(" ").padEnd(47," "),le=[...h].map(E=>E.charCodeAt(0)>=32&&E.charCodeAt(0)<127?E:".").join("");if(s.push(`${d.toString(16).padStart(8,"0")} ${J} |${le}|`),d+16>o.length)break}y(s.join(`
|
|
21
|
-
`))}const R=r.useCallback((i,o)=>{const s=++p.current,d=Re(i);if(U.current=!1,P(),X.current=null,g([]),f(null),y(""),C(null),T(null),fe(null),K(0),ee(null),te(null),ne(!1),I(null),re(null),ie(!1),pe(!0),Fe(null),xe("unavailable"),ge(!1),be(null),ve("file"),we(!1),ke(!1),O(!1),A(""),H(null),B(!1),b("initial-loading"),W.current=!1,oe.current=0,Se.current=new TextDecoder("utf-8",{fatal:!1}),de(i)){X.current=i,f(i);return}a("fs:watch",{path:on(i)}).catch(()=>{}),o==="text"?(Qe(i,s),$(i,!0,s),d&&Ee.current&&q(i,s)):o==="image"||o==="video"||o==="audio"||o==="pdf"?q(i,s):o==="hex"&&(a("fs:stat",{path:i}).then(h=>{s===p.current&&C(h)}).catch(()=>{}),Ze(i,s))},[$,Ze,q,Qe,P,a]);r.useEffect(()=>{if(e)return Ee.current=!1,Be(!1),R(e,m),()=>{p.current++,U.current=!1,P()}},[e]),r.useEffect(()=>{let i=null;const o=s=>{const d=s.detail;!d||d!==e||(i!==null&&window.clearTimeout(i),i=window.setTimeout(()=>{m==="text"&&W.current?B(!0):e&&R(e,m)},350))};return window.addEventListener("file-changed",o),()=>{window.removeEventListener("file-changed",o),i!==null&&window.clearTimeout(i)}},[e,m,R]),r.useEffect(()=>{W.current=w},[w]),r.useEffect(()=>{if(z!=="initial-loading"){He(!1);return}const i=window.setTimeout(()=>He(!0),120);return()=>window.clearTimeout(i)},[e,z]),r.useEffect(()=>{const i=Ge.current,o=qe.current;if(!i||!o||!e||m!=="text"||me||w||F!=="file"||z!=="ready"||ue)return;const s=new IntersectionObserver(d=>{d.some(h=>h.isIntersecting)&&$(e)},{root:o,rootMargin:"0px 0px 360px 0px"});return s.observe(i),()=>s.disconnect()},[w,me,m,$,ue,e,z,F]);const Ke=r.useCallback((i,o)=>{const s=URL.createObjectURL(i),d=document.createElement("a");d.href=s,d.download=Q(o),d.style.display="none",document.body.appendChild(d),d.click(),d.remove(),window.setTimeout(()=>URL.revokeObjectURL(s),1e3)},[]),St=r.useCallback(async()=>{if(!e||v!==null||j!==null)return;if(de(e)){window.open(e,"_blank","noopener,noreferrer");return}const i=e;ee(null),I(null),ne(!1),te(0);try{const o=await Me(i,a,te);Ke(o,i),ne(!0),window.setTimeout(()=>ne(!1),1500)}catch(o){ee((o==null?void 0:o.message)??String(o))}finally{te(null)}},[Ke,v,e,a,j]),jt=r.useCallback(async()=>{if(!e||j!==null||v!==null)return;const i=e;ee(null),I(null),ie(!1);const o=ct(navigator,window.isSecureContext);if(o==="insecure-context"){I("当前页面是 HTTP,手机 Chrome 仅允许 HTTPS 页面分享文件,请改用 HTTPS 地址后重试");return}if(o==="unsupported-browser"){I("当前浏览器不支持分享文件,请使用最新版手机 Chrome 或系统浏览器");return}re(0);try{const s=await Me(i,a,re),d=new File([s],Q(i),{type:dt(i),lastModified:(u==null?void 0:u.mtime)??Date.now()}),h=await ft(d,navigator);h==="unsupported"?I("当前浏览器不支持分享此文件类型,请使用下载按钮"):h==="shared"&&(ie(!0),window.setTimeout(()=>ie(!1),1500))}catch(s){I((s==null?void 0:s.message)??String(s))}finally{re(null)}},[v,u==null?void 0:u.mtime,e,a,j]),ae=r.useCallback(async(i,o)=>{const s=await a("fs:inspect-text",{path:i},6e4);return o!==p.current?null:(C({size:s.size,mtime:s.mtime}),xe(s.diffStatus),Fe(s.patch),we(!s.tooLarge&&s.validUtf8),s)},[a]),Et=r.useCallback(async()=>{if(!e||ye)return;const i=p.current;ke(!0),H(null);try{const o=await ae(e,i);if(!o)return;if(o.tooLarge||o.data===null)throw new Error("文件超过 8M,无法在线编辑");if(!o.validUtf8)throw new Error("此文件不是有效的 UTF-8 文本,无法在线编辑");const s=new TextDecoder("utf-8",{fatal:!1}).decode(Ie(o.data));g([s]),K(o.size),oe.current=o.size,pe(!0),A(s),B(!1),W.current=!0,O(!0)}catch(o){i===p.current&&H(o.message??String(o))}finally{i===p.current&&ke(!1)}},[ye,ae,e]),et=r.useCallback(async()=>{if(!e||he||(ve("diff"),se!==null))return;const i=p.current;ge(!0),be(null);try{await ae(e,i)}catch(o){i===p.current&&be(o.message??String(o))}finally{i===p.current&&ge(!1)}},[he,ae,se,e]),Ct=r.useCallback(()=>{if(!e)return;const i=!M;Ee.current=i,Be(i),i&&!c&&q(e,p.current)},[q,c,e,M]),G=r.useCallback(i=>{X.current===i&&(T(null),b("ready"))},[]),Y=r.useCallback(i=>{X.current===i&&(T("文件预览加载失败,请重试"),b("error"))},[]),Lt=r.useCallback(()=>{e&&R(e,m)},[m,e,R]),zt=r.useCallback(()=>{L!==D&&!window.confirm("放弃未保存的修改?")||(W.current=!1,O(!1),A(""),H(null),B(!1))},[L,D]),Tt=r.useCallback(()=>{w&&L!==D&&!window.confirm("放弃未保存的修改并关闭预览?")||(p.current++,P(),l())},[L,w,l,P,D]),Mt=r.useCallback(()=>{e&&(W.current=!1,O(!1),A(""),R(e,"text"))},[e,R]),Rt=r.useCallback(async()=>{if(!(!e||!u||_||L===D)){Xe(!0),H(null);try{await a("fs:write-text",{path:e,content:L,expectedSize:u.size,expectedMtime:u.mtime},6e4),W.current=!1,O(!1),A(""),R(e,"text")}catch(i){H((i==null?void 0:i.message)??String(i))}finally{Xe(!1)}}},[L,u,e,a,_,R,D]),V=r.useMemo(()=>Ot(se??""),[se]);if(!e)return null;const tt=((u==null?void 0:u.size)??0)>en,Le=!tt&&(Ae==="changed"||Ae==="untracked"),nt=m==="text"&&Ue&&z!=="initial-loading"&&!ye&&!S;return t.jsxs("div",{style:{height:"100%",display:"flex",flexDirection:"column",background:"var(--ui-term-col-bg, #101014)",color:"var(--ui-text, #e8e8ee)",colorScheme:"var(--ui-color-scheme, dark)",accentColor:"var(--ui-tab-accent, #7aa2f7)"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"9px 12px",borderBottom:"1px solid var(--ui-tree-border, #222)",background:"var(--ui-tree-bg, #121218)",flexShrink:0},children:[t.jsx("span",{className:"pv-name",style:{minWidth:0,flex:"1 1 auto",fontSize:12.5,color:"var(--ui-text, #e8e8ee)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Q(e)}),u&&t.jsx("span",{style:{fontSize:10.5,color:"var(--ui-history-meta, #666)",flexShrink:0},children:ze(u.size)}),w?t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:zt,disabled:_,style:N,"aria-label":"取消编辑",title:"取消编辑",children:t.jsx(Dt,{size:15,strokeWidth:1.8,"aria-hidden":"true"})}),t.jsx("button",{type:"button",onClick:Rt,disabled:_||L===D,style:{...N,color:"var(--ui-tab-accent, #7aa2f7)",opacity:_||L===D?.55:1},"aria-label":_?"正在保存":"保存修改",title:_?"正在保存":"保存修改",children:_?t.jsx(Z,{className:"tree-spin",size:15,strokeWidth:1.8,"aria-hidden":"true"}):t.jsx(Nt,{size:15,strokeWidth:1.8,"aria-hidden":"true"})})]}):t.jsxs(t.Fragment,{children:[m==="text"&&t.jsx("button",{type:"button",onClick:Et,disabled:!nt,style:{...N,opacity:nt?1:.45},"aria-label":"编辑文件",title:tt?"文件超过 8M,无法在线编辑":Ue?"编辑文件":"此文件不可编辑",children:t.jsx(It,{size:15,strokeWidth:1.8,"aria-hidden":"true"})}),t.jsx("button",{type:"button",onClick:St,disabled:v!==null||j!==null,style:{...N,opacity:v!==null||j!==null?.72:1},"aria-label":Ce?"打开原始地址":v===null?"下载到当前设备":`正在下载 ${v}%`,title:Ce?"打开原始地址":v===null?"下载到当前设备":`正在下载 ${v}%`,children:v!==null?t.jsx(Z,{className:"tree-spin",size:15,strokeWidth:1.8,"aria-hidden":"true"}):bt?t.jsx(rt,{size:15,strokeWidth:1.8,"aria-hidden":"true"}):t.jsx(Ht,{size:15,strokeWidth:1.8,"aria-hidden":"true"})}),!Ce&&t.jsx("button",{type:"button",onClick:jt,disabled:j!==null||v!==null,style:{...N,opacity:j!==null||v!==null?.72:1},"aria-label":"分享文件",title:j===null?"分享文件":`正在准备 ${j}%`,children:j!==null?t.jsx(Z,{className:"tree-spin",size:15,strokeWidth:1.8,"aria-hidden":"true"}):vt?t.jsx(rt,{size:15,strokeWidth:1.8,"aria-hidden":"true"}):t.jsx(Ft,{size:15,strokeWidth:1.8,"aria-hidden":"true"})}),Je&&t.jsx("button",{type:"button",onClick:Ct,"aria-pressed":M,style:{...N,...M?{color:"var(--ui-tab-accent, #7aa2f7)",borderColor:"var(--ui-tab-accent, #7aa2f7)"}:{}},"aria-label":M?"退出浏览器预览":"浏览器预览",title:M?"退出浏览器预览":Ye?"在浏览器中预览渲染效果":Ve?"预览 Markdown 排版效果":"在浏览器中查看原始文件",children:t.jsx(Pt,{size:15,strokeWidth:1.8,"aria-hidden":"true"})})]}),t.jsx("button",{type:"button",onClick:Tt,style:N,"aria-label":"关闭预览",title:"关闭预览",children:t.jsx(Wt,{size:15,strokeWidth:1.8,"aria-hidden":"true"})})]}),m==="text"&&Le&&!w&&!M&&t.jsxs("div",{style:{display:"flex",alignItems:"center",minHeight:34,padding:"0 12px",borderBottom:"1px solid var(--ui-tree-border, #222)",background:"var(--ui-tree-bg, #121218)",flexShrink:0},children:[t.jsxs("div",{role:"tablist","aria-label":"文件预览模式",style:{display:"inline-flex",gap:2,padding:2,border:"1px solid var(--ui-panel-input-border, #333)",borderRadius:6,background:"var(--ui-muted-surface, #1b1b22)"},children:[t.jsx(st,{active:F==="diff",onClick:et,children:"变更"}),t.jsx(st,{active:F==="file",onClick:()=>ve("file"),children:"文件"})]}),t.jsxs("span",{style:{marginLeft:9,display:"inline-flex",gap:7,fontFamily:'"SF Mono", Menlo, Consolas, monospace',fontSize:10.5},children:[V.added>0&&t.jsxs("span",{style:{color:"var(--ui-success, #059669)"},children:["+",V.added]}),V.removed>0&&t.jsxs("span",{style:{color:"var(--ui-error, #dc2626)"},children:["-",V.removed]})]})]}),Ne&&t.jsxs("div",{role:"alert",style:{flexShrink:0,padding:"8px 12px",borderBottom:"1px solid var(--ui-tree-border, #222)",background:"var(--ui-tree-bg, #121218)",color:"var(--ui-error, #f7768e)",fontSize:12.5,lineHeight:1.5},children:["分享失败:",Ne]}),t.jsxs("div",{ref:qe,className:"pv-body",style:{position:"relative",flex:1,minHeight:0,overflow:"auto",background:"var(--ui-term-col-bg, #101014)",WebkitOverflowScrolling:"touch"},children:[Pe&&t.jsxs("div",{style:{padding:"10px 14px 0",color:"var(--ui-error, #f7768e)",fontSize:12.5},children:["下载失败:",Pe]}),$e&&t.jsx("div",{role:"alert",style:{padding:"10px 14px",color:"var(--ui-error, #f7768e)",fontSize:12.5},children:$e}),wt&&w&&t.jsxs("div",{role:"alert",style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",borderBottom:"1px solid var(--ui-tree-border, #222)",color:"var(--ui-error, #f7768e)",fontSize:12},children:[t.jsx("span",{style:{flex:1},children:"文件已在其他位置更新"}),t.jsxs("button",{type:"button",onClick:Mt,style:_e,children:[t.jsx(Te,{size:13,strokeWidth:1.8,"aria-hidden":"true"}),"重新加载"]})]}),c&&!S&&m==="image"&&t.jsx("img",{src:c,alt:e,onLoad:()=>G(c),onError:()=>Y(c),style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain",display:"block",margin:"0 auto"}}),c&&!S&&m==="video"&&t.jsx("video",{src:c,controls:!0,playsInline:!0,preload:"metadata",onLoadedMetadata:()=>G(c),onError:()=>Y(c),style:{maxWidth:"100%",maxHeight:"100%",display:"block",margin:"0 auto"}}),c&&!S&&m==="audio"&&t.jsx("div",{style:{display:"grid",placeItems:"center",height:"100%"},children:t.jsx("audio",{src:c,controls:!0,autoPlay:!0,onLoadedMetadata:()=>G(c),onError:()=>Y(c),style:{width:"min(420px, 88%)"}})}),c&&!S&&m==="pdf"&&t.jsx("iframe",{src:c,title:e,onLoad:()=>G(c),onError:()=>Y(c),style:{width:"100%",height:"100%",border:"none"}}),c&&!S&&m==="text"&&Je&&M&&!w&&t.jsx("iframe",{src:yt?`${c}/${encodeURIComponent(Q(e))}`:c,sandbox:Jt,title:e,onLoad:()=>G(c),onError:()=>Y(c),style:{width:"100%",height:"100%",border:"none",background:"#fff"}}),m==="text"&&w&&!S&&t.jsx("textarea",{value:L,onChange:i=>A(i.target.value),spellCheck:!1,autoCapitalize:"off",autoCorrect:"off","aria-label":`编辑 ${Q(e)}`,style:{width:"100%",minHeight:"100%",boxSizing:"border-box",resize:"none",margin:0,padding:"12px 14px calc(env(safe-area-inset-bottom) + 36px)",border:0,outline:0,background:"var(--ui-term-col-bg, #101014)",color:"var(--ui-history-item-text, var(--ui-text, #d6d6de))",fontFamily:'"SF Mono", Menlo, Consolas, monospace',fontSize:12,lineHeight:1.5,tabSize:2}}),m==="text"&&!w&&!S&&Le&&F==="diff"&&(Oe?t.jsx(ce,{label:Oe,actionLabel:"重试",onAction:()=>void et(),tone:"error"}):he?t.jsx(ce,{label:"正在加载变更"}):t.jsx(an,{rows:V.rows})),(m==="hex"||m==="text"&&!w&&!M&&(!Le||F==="file"))&&!S&&t.jsxs(t.Fragment,{children:[t.jsx("pre",{style:{margin:0,padding:"11px 13px calc(env(safe-area-inset-bottom) + 36px)",fontFamily:'"SF Mono", Menlo, Consolas, monospace',fontSize:m==="hex"?10.5:12,lineHeight:1.45,color:m==="hex"?"var(--ui-muted-text, #9aa)":"var(--ui-history-item-text, var(--ui-text, #d6d6de))",whiteSpace:m==="hex"?"pre":"pre-wrap",wordBreak:m==="hex"?"normal":"break-word"},children:m==="hex"?k:t.jsx($t,{path:e,chunks:x,fileSize:u==null?void 0:u.size})}),m==="text"&&!me&&t.jsxs("div",{ref:Ge,role:"status","aria-live":"polite",style:{minHeight:44,padding:"0 14px calc(env(safe-area-inset-bottom) + 8px)",display:"flex",alignItems:"center",justifyContent:"center",gap:7,color:"var(--ui-history-meta, #666)",fontSize:11.5},children:[z==="loading-more"&&t.jsx(Z,{className:"tree-spin",size:14,strokeWidth:1.8,"aria-hidden":"true",style:{color:"var(--ui-tab-accent, #7aa2f7)"}}),ue?t.jsxs(t.Fragment,{children:[t.jsx("span",{children:"加载失败"}),t.jsxs("button",{type:"button",onClick:()=>$(e),style:_e,children:[t.jsx(Te,{size:13,strokeWidth:1.8,"aria-hidden":"true"}),"重试"]})]}):t.jsx("span",{children:z==="loading-more"?"正在加载更多":`${ze(We)} / ${ze((u==null?void 0:u.size)??We)}`})]})]}),gt&&z==="initial-loading"&&t.jsx(ce,{label:"正在加载文件"}),S&&z==="error"&&t.jsx(ce,{label:S,actionLabel:"重试",onAction:Lt,tone:"error"})]})]})}function Q(e){return e.slice(e.lastIndexOf("/")+1)||e}function on(e){const n=e.lastIndexOf("/");return n>0?e.slice(0,n):"/"}function ze(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}K`:`${(e/1024/1024).toFixed(1)}M`}const N={width:28,height:28,borderRadius:7,border:"1px solid var(--ui-panel-input-border, #333)",display:"inline-flex",alignItems:"center",justifyContent:"center",background:"var(--ui-muted-surface, #1b1b22)",color:"var(--ui-muted-text, #ccc)",flexShrink:0,cursor:"pointer",WebkitAppRegion:"no-drag"},_e={minHeight:28,padding:"0 9px",borderRadius:6,border:"1px solid var(--ui-panel-input-border, #333)",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:5,background:"var(--ui-muted-surface, #1b1b22)",color:"var(--ui-muted-text, #ccc)",cursor:"pointer",fontSize:11};function ce({label:e,actionLabel:n,onAction:l,tone:a="muted"}){return t.jsxs("div",{role:a==="error"?"alert":"status",style:{position:"absolute",inset:0,minHeight:120,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:10,color:a==="error"?"var(--ui-error, #f7768e)":"var(--ui-muted-text, #9aa)",fontSize:12.5},children:[a!=="error"&&t.jsx(Z,{className:"tree-spin",size:18,strokeWidth:1.8,"aria-hidden":"true",style:{color:"var(--ui-tab-accent, #7aa2f7)"}}),t.jsx("span",{children:e}),n&&l&&t.jsxs("button",{type:"button",onClick:l,style:_e,children:[t.jsx(Te,{size:13,strokeWidth:1.8,"aria-hidden":"true"}),n]})]})}function st({active:e,onClick:n,children:l}){return t.jsx("button",{type:"button",role:"tab","aria-selected":e,onClick:n,style:{minWidth:48,height:24,padding:"0 9px",border:0,borderRadius:4,background:e?"var(--ui-tab-accent, #7aa2f7)":"transparent",color:e?"var(--ui-tab-active-text, #fff)":"var(--ui-muted-text, #9aa)",fontSize:11,fontWeight:600,cursor:"pointer"},children:l})}function an({rows:e}){return t.jsx("div",{style:{minWidth:"100%",width:"max-content",paddingBottom:"calc(env(safe-area-inset-bottom) + 36px)",fontFamily:'"SF Mono", Menlo, Consolas, monospace',fontSize:11.5,lineHeight:1.55},children:e.map((n,l)=>{const a=n.kind==="added",x=n.kind==="removed",g=n.kind==="hunk"||n.kind==="meta"||n.kind==="note",c=a?"color-mix(in srgb, var(--ui-success, #059669) 12%, transparent)":x?"color-mix(in srgb, var(--ui-error, #dc2626) 11%, transparent)":n.kind==="hunk"?"color-mix(in srgb, var(--ui-tab-accent, #7aa2f7) 10%, transparent)":"transparent",f=a?"var(--ui-success, #059669)":x?"var(--ui-error, #dc2626)":g?"var(--ui-muted-text, #9aa)":"var(--ui-history-item-text, var(--ui-text, #d6d6de))";return t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"42px 42px 22px minmax(0, 1fr)",minHeight:18,background:c,color:f},children:[t.jsx("span",{style:ot,children:n.oldLine??""}),t.jsx("span",{style:ot,children:n.newLine??""}),t.jsx("span",{style:{textAlign:"center",userSelect:"none",color:f},children:a?"+":x?"-":" "}),t.jsx("span",{style:{padding:"0 12px 0 6px",whiteSpace:"pre-wrap",overflowWrap:"anywhere"},children:n.text||" "})]},`${n.kind}-${l}`)})})}const ot={padding:"0 6px",borderRight:"1px solid var(--ui-tree-border, #222)",color:"var(--ui-history-meta, #666)",textAlign:"right",userSelect:"none"},hn=Object.freeze(Object.defineProperty({__proto__:null,MAX_CLIENT_DOWNLOAD_BYTES:lt,decodeTextChunk:mt,default:sn,isBrowserPreviewPath:Re,isHtmlPreviewPath:pt,isMarkdownPreviewPath:xt,kindOf:ht,mimeTypeForPath:dt,nativeFileShareReadiness:ct,readFileForClientDownload:Me,shareFileWithNativePicker:ft},Symbol.toStringTag,{value:"Module"}));export{sn as F,it as M,xn as a,hn as b,Ut as c};
|
|
21
|
+
`))}const R=r.useCallback((i,o)=>{const s=++p.current,d=Re(i);if(U.current=!1,P(),X.current=null,g([]),f(null),y(""),C(null),T(null),fe(null),K(0),ee(null),te(null),ne(!1),I(null),re(null),ie(!1),pe(!0),Fe(null),xe("unavailable"),ge(!1),be(null),ve("file"),we(!1),ke(!1),O(!1),A(""),H(null),B(!1),b("initial-loading"),W.current=!1,oe.current=0,Se.current=new TextDecoder("utf-8",{fatal:!1}),de(i)){X.current=i,f(i);return}a("fs:watch",{path:on(i)}).catch(()=>{}),o==="text"?(Qe(i,s),$(i,!0,s),d&&Ee.current&&q(i,s)):o==="image"||o==="video"||o==="audio"||o==="pdf"?q(i,s):o==="hex"&&(a("fs:stat",{path:i}).then(h=>{s===p.current&&C(h)}).catch(()=>{}),Ze(i,s))},[$,Ze,q,Qe,P,a]);r.useEffect(()=>{if(e)return Ee.current=!1,Be(!1),R(e,m),()=>{p.current++,U.current=!1,P()}},[e]),r.useEffect(()=>{let i=null;const o=s=>{const d=s.detail;!d||d!==e||(i!==null&&window.clearTimeout(i),i=window.setTimeout(()=>{m==="text"&&W.current?B(!0):e&&R(e,m)},350))};return window.addEventListener("file-changed",o),()=>{window.removeEventListener("file-changed",o),i!==null&&window.clearTimeout(i)}},[e,m,R]),r.useEffect(()=>{W.current=w},[w]),r.useEffect(()=>{if(z!=="initial-loading"){He(!1);return}const i=window.setTimeout(()=>He(!0),120);return()=>window.clearTimeout(i)},[e,z]),r.useEffect(()=>{const i=Ge.current,o=qe.current;if(!i||!o||!e||m!=="text"||me||w||F!=="file"||z!=="ready"||ue)return;const s=new IntersectionObserver(d=>{d.some(h=>h.isIntersecting)&&$(e)},{root:o,rootMargin:"0px 0px 360px 0px"});return s.observe(i),()=>s.disconnect()},[w,me,m,$,ue,e,z,F]);const Ke=r.useCallback((i,o)=>{const s=URL.createObjectURL(i),d=document.createElement("a");d.href=s,d.download=Q(o),d.style.display="none",document.body.appendChild(d),d.click(),d.remove(),window.setTimeout(()=>URL.revokeObjectURL(s),1e3)},[]),St=r.useCallback(async()=>{if(!e||v!==null||j!==null)return;if(de(e)){window.open(e,"_blank","noopener,noreferrer");return}const i=e;ee(null),I(null),ne(!1),te(0);try{const o=await Me(i,a,te);Ke(o,i),ne(!0),window.setTimeout(()=>ne(!1),1500)}catch(o){ee((o==null?void 0:o.message)??String(o))}finally{te(null)}},[Ke,v,e,a,j]),jt=r.useCallback(async()=>{if(!e||j!==null||v!==null)return;const i=e;ee(null),I(null),ie(!1);const o=ct(navigator,window.isSecureContext);if(o==="insecure-context"){I("当前页面是 HTTP,手机 Chrome 仅允许 HTTPS 页面分享文件,请改用 HTTPS 地址后重试");return}if(o==="unsupported-browser"){I("当前浏览器不支持分享文件,请使用最新版手机 Chrome 或系统浏览器");return}re(0);try{const s=await Me(i,a,re),d=new File([s],Q(i),{type:dt(i),lastModified:(u==null?void 0:u.mtime)??Date.now()}),h=await ft(d,navigator);h==="unsupported"?I("当前浏览器不支持分享此文件类型,请使用下载按钮"):h==="shared"&&(ie(!0),window.setTimeout(()=>ie(!1),1500))}catch(s){I((s==null?void 0:s.message)??String(s))}finally{re(null)}},[v,u==null?void 0:u.mtime,e,a,j]),ae=r.useCallback(async(i,o)=>{const s=await a("fs:inspect-text",{path:i},6e4);return o!==p.current?null:(C({size:s.size,mtime:s.mtime}),xe(s.diffStatus),Fe(s.patch),we(!s.tooLarge&&s.validUtf8),s)},[a]),Et=r.useCallback(async()=>{if(!e||ye)return;const i=p.current;ke(!0),H(null);try{const o=await ae(e,i);if(!o)return;if(o.tooLarge||o.data===null)throw new Error("文件超过 8M,无法在线编辑");if(!o.validUtf8)throw new Error("此文件不是有效的 UTF-8 文本,无法在线编辑");const s=new TextDecoder("utf-8",{fatal:!1}).decode(Ie(o.data));g([s]),K(o.size),oe.current=o.size,pe(!0),A(s),B(!1),W.current=!0,O(!0)}catch(o){i===p.current&&H(o.message??String(o))}finally{i===p.current&&ke(!1)}},[ye,ae,e]),et=r.useCallback(async()=>{if(!e||he||(ve("diff"),se!==null))return;const i=p.current;ge(!0),be(null);try{await ae(e,i)}catch(o){i===p.current&&be(o.message??String(o))}finally{i===p.current&&ge(!1)}},[he,ae,se,e]),Ct=r.useCallback(()=>{if(!e)return;const i=!M;Ee.current=i,Be(i),i&&!c&&q(e,p.current)},[q,c,e,M]),G=r.useCallback(i=>{X.current===i&&(T(null),b("ready"))},[]),Y=r.useCallback(i=>{X.current===i&&(T("文件预览加载失败,请重试"),b("error"))},[]),Lt=r.useCallback(()=>{e&&R(e,m)},[m,e,R]),zt=r.useCallback(()=>{L!==D&&!window.confirm("放弃未保存的修改?")||(W.current=!1,O(!1),A(""),H(null),B(!1))},[L,D]),Tt=r.useCallback(()=>{w&&L!==D&&!window.confirm("放弃未保存的修改并关闭预览?")||(p.current++,P(),l())},[L,w,l,P,D]),Mt=r.useCallback(()=>{e&&(W.current=!1,O(!1),A(""),R(e,"text"))},[e,R]),Rt=r.useCallback(async()=>{if(!(!e||!u||_||L===D)){Xe(!0),H(null);try{await a("fs:write-text",{path:e,content:L,expectedSize:u.size,expectedMtime:u.mtime},6e4),W.current=!1,O(!1),A(""),R(e,"text")}catch(i){H((i==null?void 0:i.message)??String(i))}finally{Xe(!1)}}},[L,u,e,a,_,R,D]),V=r.useMemo(()=>Ot(se??""),[se]);if(!e)return null;const tt=((u==null?void 0:u.size)??0)>en,Le=!tt&&(Ae==="changed"||Ae==="untracked"),nt=m==="text"&&Ue&&z!=="initial-loading"&&!ye&&!S;return t.jsxs("div",{style:{height:"100%",display:"flex",flexDirection:"column",background:"var(--ui-term-col-bg, #101014)",color:"var(--ui-text, #e8e8ee)",colorScheme:"var(--ui-color-scheme, dark)",accentColor:"var(--ui-tab-accent, #7aa2f7)"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"9px 12px",borderBottom:"1px solid var(--ui-tree-border, #222)",background:"var(--ui-tree-bg, #121218)",flexShrink:0},children:[t.jsx("span",{className:"pv-name",style:{minWidth:0,flex:"1 1 auto",fontSize:12.5,color:"var(--ui-text, #e8e8ee)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Q(e)}),u&&t.jsx("span",{style:{fontSize:10.5,color:"var(--ui-history-meta, #666)",flexShrink:0},children:ze(u.size)}),w?t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:zt,disabled:_,style:N,"aria-label":"取消编辑",title:"取消编辑",children:t.jsx(Dt,{size:15,strokeWidth:1.8,"aria-hidden":"true"})}),t.jsx("button",{type:"button",onClick:Rt,disabled:_||L===D,style:{...N,color:"var(--ui-tab-accent, #7aa2f7)",opacity:_||L===D?.55:1},"aria-label":_?"正在保存":"保存修改",title:_?"正在保存":"保存修改",children:_?t.jsx(Z,{className:"tree-spin",size:15,strokeWidth:1.8,"aria-hidden":"true"}):t.jsx(Nt,{size:15,strokeWidth:1.8,"aria-hidden":"true"})})]}):t.jsxs(t.Fragment,{children:[m==="text"&&t.jsx("button",{type:"button",onClick:Et,disabled:!nt,style:{...N,opacity:nt?1:.45},"aria-label":"编辑文件",title:tt?"文件超过 8M,无法在线编辑":Ue?"编辑文件":"此文件不可编辑",children:t.jsx(It,{size:15,strokeWidth:1.8,"aria-hidden":"true"})}),t.jsx("button",{type:"button",onClick:St,disabled:v!==null||j!==null,style:{...N,opacity:v!==null||j!==null?.72:1},"aria-label":Ce?"打开原始地址":v===null?"下载到当前设备":`正在下载 ${v}%`,title:Ce?"打开原始地址":v===null?"下载到当前设备":`正在下载 ${v}%`,children:v!==null?t.jsx(Z,{className:"tree-spin",size:15,strokeWidth:1.8,"aria-hidden":"true"}):bt?t.jsx(rt,{size:15,strokeWidth:1.8,"aria-hidden":"true"}):t.jsx(Ht,{size:15,strokeWidth:1.8,"aria-hidden":"true"})}),!Ce&&t.jsx("button",{type:"button",onClick:jt,disabled:j!==null||v!==null,style:{...N,opacity:j!==null||v!==null?.72:1},"aria-label":"分享文件",title:j===null?"分享文件":`正在准备 ${j}%`,children:j!==null?t.jsx(Z,{className:"tree-spin",size:15,strokeWidth:1.8,"aria-hidden":"true"}):vt?t.jsx(rt,{size:15,strokeWidth:1.8,"aria-hidden":"true"}):t.jsx(Ft,{size:15,strokeWidth:1.8,"aria-hidden":"true"})}),Je&&t.jsx("button",{type:"button",onClick:Ct,"aria-pressed":M,style:{...N,...M?{color:"var(--ui-tab-accent, #7aa2f7)",borderColor:"var(--ui-tab-accent, #7aa2f7)"}:{}},"aria-label":M?"退出浏览器预览":"浏览器预览",title:M?"退出浏览器预览":Ye?"在浏览器中预览渲染效果":Ve?"预览 Markdown 排版效果":"在浏览器中查看原始文件",children:t.jsx(Pt,{size:15,strokeWidth:1.8,"aria-hidden":"true"})})]}),t.jsx("button",{type:"button",onClick:Tt,style:N,"aria-label":"关闭预览",title:"关闭预览",children:t.jsx(Wt,{size:15,strokeWidth:1.8,"aria-hidden":"true"})})]}),m==="text"&&Le&&!w&&!M&&t.jsxs("div",{style:{display:"flex",alignItems:"center",minHeight:34,padding:"0 12px",borderBottom:"1px solid var(--ui-tree-border, #222)",background:"var(--ui-tree-bg, #121218)",flexShrink:0},children:[t.jsxs("div",{role:"tablist","aria-label":"文件预览模式",style:{display:"inline-flex",gap:2,padding:2,border:"1px solid var(--ui-panel-input-border, #333)",borderRadius:6,background:"var(--ui-muted-surface, #1b1b22)"},children:[t.jsx(st,{active:F==="diff",onClick:et,children:"变更"}),t.jsx(st,{active:F==="file",onClick:()=>ve("file"),children:"文件"})]}),t.jsxs("span",{style:{marginLeft:9,display:"inline-flex",gap:7,fontFamily:'"SF Mono", Menlo, Consolas, monospace',fontSize:10.5},children:[V.added>0&&t.jsxs("span",{style:{color:"var(--ui-success, #059669)"},children:["+",V.added]}),V.removed>0&&t.jsxs("span",{style:{color:"var(--ui-error, #dc2626)"},children:["-",V.removed]})]})]}),Ne&&t.jsxs("div",{role:"alert",style:{flexShrink:0,padding:"8px 12px",borderBottom:"1px solid var(--ui-tree-border, #222)",background:"var(--ui-tree-bg, #121218)",color:"var(--ui-error, #f7768e)",fontSize:12.5,lineHeight:1.5},children:["分享失败:",Ne]}),t.jsxs("div",{ref:qe,className:"pv-body",style:{position:"relative",flex:1,minHeight:0,overflow:"auto",background:"var(--ui-term-col-bg, #101014)",WebkitOverflowScrolling:"touch"},children:[Pe&&t.jsxs("div",{style:{padding:"10px 14px 0",color:"var(--ui-error, #f7768e)",fontSize:12.5},children:["下载失败:",Pe]}),$e&&t.jsx("div",{role:"alert",style:{padding:"10px 14px",color:"var(--ui-error, #f7768e)",fontSize:12.5},children:$e}),wt&&w&&t.jsxs("div",{role:"alert",style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",borderBottom:"1px solid var(--ui-tree-border, #222)",color:"var(--ui-error, #f7768e)",fontSize:12},children:[t.jsx("span",{style:{flex:1},children:"文件已在其他位置更新"}),t.jsxs("button",{type:"button",onClick:Mt,style:_e,children:[t.jsx(Te,{size:13,strokeWidth:1.8,"aria-hidden":"true"}),"重新加载"]})]}),c&&!S&&m==="image"&&t.jsx("img",{src:c,alt:e,onLoad:()=>G(c),onError:()=>Y(c),style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain",display:"block",margin:"0 auto"}}),c&&!S&&m==="video"&&t.jsx("video",{src:c,controls:!0,playsInline:!0,preload:"metadata",onLoadedMetadata:()=>G(c),onError:()=>Y(c),style:{maxWidth:"100%",maxHeight:"100%",display:"block",margin:"0 auto"}}),c&&!S&&m==="audio"&&t.jsx("div",{style:{display:"grid",placeItems:"center",height:"100%"},children:t.jsx("audio",{src:c,controls:!0,autoPlay:!0,onLoadedMetadata:()=>G(c),onError:()=>Y(c),style:{width:"min(420px, 88%)"}})}),c&&!S&&m==="pdf"&&t.jsx("iframe",{src:c,title:e,onLoad:()=>G(c),onError:()=>Y(c),style:{width:"100%",height:"100%",border:"none"}}),c&&!S&&m==="text"&&Je&&M&&!w&&t.jsx("iframe",{src:yt?`${c}/${encodeURIComponent(Q(e))}`:c,sandbox:Jt,title:e,onLoad:()=>G(c),onError:()=>Y(c),style:{width:"100%",height:"100%",border:"none",background:"#fff"}}),m==="text"&&w&&!S&&t.jsx("textarea",{value:L,onChange:i=>A(i.target.value),spellCheck:!1,autoCapitalize:"off",autoCorrect:"off","aria-label":`编辑 ${Q(e)}`,style:{width:"100%",minHeight:"100%",boxSizing:"border-box",resize:"none",margin:0,padding:"12px 14px calc(env(safe-area-inset-bottom) + 36px)",border:0,outline:0,background:"var(--ui-term-col-bg, #101014)",color:"var(--ui-history-item-text, var(--ui-text, #d6d6de))",fontFamily:'"SF Mono", Menlo, Consolas, monospace',fontSize:12,lineHeight:1.5,tabSize:2}}),m==="text"&&!w&&!S&&Le&&F==="diff"&&(Oe?t.jsx(ce,{label:Oe,actionLabel:"重试",onAction:()=>void et(),tone:"error"}):he?t.jsx(ce,{label:"正在加载变更"}):t.jsx(an,{rows:V.rows})),(m==="hex"||m==="text"&&!w&&!M&&(!Le||F==="file"))&&!S&&t.jsxs(t.Fragment,{children:[t.jsx("pre",{style:{margin:0,padding:"11px 13px calc(env(safe-area-inset-bottom) + 36px)",fontFamily:'"SF Mono", Menlo, Consolas, monospace',fontSize:m==="hex"?10.5:12,lineHeight:1.45,color:m==="hex"?"var(--ui-muted-text, #9aa)":"var(--ui-history-item-text, var(--ui-text, #d6d6de))",whiteSpace:m==="hex"?"pre":"pre-wrap",wordBreak:m==="hex"?"normal":"break-word"},children:m==="hex"?k:t.jsx($t,{path:e,chunks:x,fileSize:u==null?void 0:u.size})}),m==="text"&&!me&&t.jsxs("div",{ref:Ge,role:"status","aria-live":"polite",style:{minHeight:44,padding:"0 14px calc(env(safe-area-inset-bottom) + 8px)",display:"flex",alignItems:"center",justifyContent:"center",gap:7,color:"var(--ui-history-meta, #666)",fontSize:11.5},children:[z==="loading-more"&&t.jsx(Z,{className:"tree-spin",size:14,strokeWidth:1.8,"aria-hidden":"true",style:{color:"var(--ui-tab-accent, #7aa2f7)"}}),ue?t.jsxs(t.Fragment,{children:[t.jsx("span",{children:"加载失败"}),t.jsxs("button",{type:"button",onClick:()=>$(e),style:_e,children:[t.jsx(Te,{size:13,strokeWidth:1.8,"aria-hidden":"true"}),"重试"]})]}):t.jsx("span",{children:z==="loading-more"?"正在加载更多":`${ze(We)} / ${ze((u==null?void 0:u.size)??We)}`})]})]}),gt&&z==="initial-loading"&&t.jsx(ce,{label:"正在加载文件"}),S&&z==="error"&&t.jsx(ce,{label:S,actionLabel:"重试",onAction:Lt,tone:"error"})]})]})}function Q(e){return e.slice(e.lastIndexOf("/")+1)||e}function on(e){const n=e.lastIndexOf("/");return n>0?e.slice(0,n):"/"}function ze(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}K`:`${(e/1024/1024).toFixed(1)}M`}const N={width:28,height:28,borderRadius:7,border:"1px solid var(--ui-panel-input-border, #333)",display:"inline-flex",alignItems:"center",justifyContent:"center",background:"var(--ui-muted-surface, #1b1b22)",color:"var(--ui-muted-text, #ccc)",flexShrink:0,cursor:"pointer",WebkitAppRegion:"no-drag"},_e={minHeight:28,padding:"0 9px",borderRadius:6,border:"1px solid var(--ui-panel-input-border, #333)",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:5,background:"var(--ui-muted-surface, #1b1b22)",color:"var(--ui-muted-text, #ccc)",cursor:"pointer",fontSize:11};function ce({label:e,actionLabel:n,onAction:l,tone:a="muted"}){return t.jsxs("div",{role:a==="error"?"alert":"status",style:{position:"absolute",inset:0,minHeight:120,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:10,color:a==="error"?"var(--ui-error, #f7768e)":"var(--ui-muted-text, #9aa)",fontSize:12.5},children:[a!=="error"&&t.jsx(Z,{className:"tree-spin",size:18,strokeWidth:1.8,"aria-hidden":"true",style:{color:"var(--ui-tab-accent, #7aa2f7)"}}),t.jsx("span",{children:e}),n&&l&&t.jsxs("button",{type:"button",onClick:l,style:_e,children:[t.jsx(Te,{size:13,strokeWidth:1.8,"aria-hidden":"true"}),n]})]})}function st({active:e,onClick:n,children:l}){return t.jsx("button",{type:"button",role:"tab","aria-selected":e,onClick:n,style:{minWidth:48,height:24,padding:"0 9px",border:0,borderRadius:4,background:e?"var(--ui-tab-accent, #7aa2f7)":"transparent",color:e?"var(--ui-tab-active-text, #fff)":"var(--ui-muted-text, #9aa)",fontSize:11,fontWeight:600,cursor:"pointer"},children:l})}function an({rows:e}){return t.jsx("div",{style:{minWidth:"100%",width:"max-content",paddingBottom:"calc(env(safe-area-inset-bottom) + 36px)",fontFamily:'"SF Mono", Menlo, Consolas, monospace',fontSize:11.5,lineHeight:1.55},children:e.map((n,l)=>{const a=n.kind==="added",x=n.kind==="removed",g=n.kind==="hunk"||n.kind==="meta"||n.kind==="note",c=a?"color-mix(in srgb, var(--ui-success, #059669) 12%, transparent)":x?"color-mix(in srgb, var(--ui-error, #dc2626) 11%, transparent)":n.kind==="hunk"?"color-mix(in srgb, var(--ui-tab-accent, #7aa2f7) 10%, transparent)":"transparent",f=a?"var(--ui-success, #059669)":x?"var(--ui-error, #dc2626)":g?"var(--ui-muted-text, #9aa)":"var(--ui-history-item-text, var(--ui-text, #d6d6de))";return t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"42px 42px 22px minmax(0, 1fr)",minHeight:18,background:c,color:f},children:[t.jsx("span",{style:ot,children:n.oldLine??""}),t.jsx("span",{style:ot,children:n.newLine??""}),t.jsx("span",{style:{textAlign:"center",userSelect:"none",color:f},children:a?"+":x?"-":" "}),t.jsx("span",{style:{padding:"0 12px 0 6px",whiteSpace:"pre-wrap",overflowWrap:"anywhere"},children:n.text||" "})]},`${n.kind}-${l}`)})})}const ot={padding:"0 6px",borderRight:"1px solid var(--ui-tree-border, #222)",color:"var(--ui-history-meta, #666)",textAlign:"right",userSelect:"none"},gn=Object.freeze(Object.defineProperty({__proto__:null,MAX_CLIENT_DOWNLOAD_BYTES:lt,decodeTextChunk:mt,default:sn,isBrowserPreviewPath:Re,isHtmlPreviewPath:pt,isMarkdownPreviewPath:xt,kindOf:ht,mimeTypeForPath:dt,nativeFileShareReadiness:ct,readFileForClientDownload:Me,shareFileWithNativePicker:ft},Symbol.toStringTag,{value:"Module"}));export{sn as F,it as M,hn as a,gn as b,Ut as c};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{c as ce,r as l,j as s,P as oe}from"./index-CTJNAMck.js";import{S as de,i as Y,F as ue,D as fe,P as pe,a as me,b as he,c as xe,d as je,N as be,e as ve,f as ze,g as Ne,h as ge,j as Fe}from"./file-types-0e-tNIVd.js";import{L as ke}from"./locate-fixed-ByJuEKxC.js";import{X as ye}from"./x-CeSbythI.js";import{L as Z}from"./loader-circle-CZdAfU-D.js";import{C as _}from"./chevron-down-DwzPFeq8.js";import{C as S}from"./chevron-right-kcIXzCMb.js";import{F as T}from"./trash-2-DLDxY6J7.js";/**
|
|
2
|
+
* @license lucide-react v0.468.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const $e=ce("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]]);function R(i){const p=i.replace(/\/{2,}/g,"/");return p.length>1?p.replace(/\/+$/,""):p}function se(i){const p=R(i),c=p.lastIndexOf("/");return c<=0?"/":p.slice(0,c)}function re(i,p){const c=R(i),d=R(p);return d==="/"?c.startsWith("/"):c.startsWith(`${d}/`)}function Ie(i,p){const c=R(i);if(!re(p,c))return[];const d=se(p);if(d===c)return[c];const u=d.slice(c==="/"?1:c.length+1),I=[c];let z=c;for(const F of u.split("/").filter(Boolean))z=z==="/"?`/${F}`:`${z}/${F}`,I.push(z);return I}const Le={code:{icon:ge,color:"#7aa2f7",label:"代码文件"},style:{icon:oe,color:"#bb9af7",label:"样式文件"},image:{icon:Ne,color:"#9ece6a",label:"图片文件"},video:{icon:ze,color:"#f7768e",label:"视频文件"},audio:{icon:ve,color:"#c099ff",label:"音频文件"},markdown:{icon:be,color:"#73daca",label:"Markdown 文件"},text:{icon:je,color:"#a9b1d6",label:"文本文件"},json:{icon:xe,color:"#e0af68",label:"JSON 文件"},archive:{icon:he,color:"#ff9e64",label:"压缩文件"},spreadsheet:{icon:me,color:"#9ece6a",label:"表格文件"},presentation:{icon:pe,color:"#f7768e",label:"演示文件"},database:{icon:fe,color:"#2ac3de",label:"数据库文件"},file:{icon:ue,color:"#c8c8d0",label:"文件"}};function De(i){return Le[Fe(i)]}function ee(i){return i<1024?`${i}B`:i<1024*1024?`${(i/1024).toFixed(1)}K`:i<1024*1024*1024?`${(i/1024/1024).toFixed(1)}M`:`${(i/1024/1024/1024).toFixed(1)}G`}function Be({gateway:i,onOpenFile:p,selectedPath:c,ready:d,cwd:u,followCwd:I,initialRoot:z,initialFollow:F=!0,onTreeStateChange:m,revealRequest:b}){const y=i.request,W=i.subscribe,[f,te]=l.useState(null),[w,M]=l.useState(""),[O,B]=l.useState(""),[ne,L]=l.useState(!F),[A,ae]=l.useState(""),v=l.useRef(new Map),D=l.useRef(null),H=l.useRef(null),C=l.useRef(0),J=l.useRef(0),[,le]=l.useState(0),E=()=>le(e=>e+1),N=l.useCallback(async(e,r)=>{const t={path:e,depth:r,expanded:!0,children:null,loading:!0};v.current.set(e,t),E();try{const n=await y("fs:list",{path:e});t.children=n.entries,y("fs:watch",{path:e}).catch(()=>{})}catch(n){t.children=[],t.error=(n==null?void 0:n.message)??"read failed"}return t.loading=!1,E(),t},[y]),k=!!I&&!ne,x=l.useCallback(e=>{const r=e.length>1?e.replace(/\/+$/,""):e;D.current=r,v.current.clear(),te({path:r,depth:0,expanded:!1,children:null,loading:!1}),B(r)},[]);l.useEffect(()=>{!d||!u||!k||D.current!==u&&(x(u),m==null||m(u,!0))},[d,u,k,x]),l.useEffect(()=>{!d||!z||F||D.current||(L(!0),x(z))},[d,z,F,x]),l.useEffect(()=>{d&&y("hello").then(e=>{ae(e.home),k&&!u&&!D.current&&x(e.home)}).catch(()=>{})},[d,u,k,y,x]);const K=()=>{let e=O.trim();e&&(e==="~"?e=A||u||"/":e.startsWith("~/")?e=`${A||u||""}${e.slice(1)}`:e.startsWith("/")||(e=`${u||(f==null?void 0:f.path)||A||"/"}/${e}`),e=e.replace(/\/+/g,"/"),L(!0),x(e),m==null||m(e,!1))},ie=()=>{L(!1),u&&(x(u),m==null||m(u,!0))},V=l.useCallback(async e=>{let r=v.current.get(e);r||(r={path:e,depth:0,expanded:!1,children:null,loading:!1},v.current.set(e,r)),r.expanded?r.expanded=!1:(r.expanded=!0,!r.children&&!r.loading&&await N(e,r.depth)),E()},[N]),G=l.useCallback(async(e,r)=>{let t=v.current.get(e);t?!t.children&&!t.loading&&await N(e,r):t=await N(e,r),t.expanded=!0,E()},[N]),X=l.useCallback(async(e,r)=>{const t=se(e);let n=(f==null?void 0:f.path)??t;re(e,n)||(n=t,L(!0),x(n),m==null||m(n,!1));const a=Ie(n,e);for(let j=0;j<a.length;j+=1){if(C.current!==r)return;await G(a[j],j)}const g=()=>{var h;if(C.current!==r)return;const j=Array.from(((h=H.current)==null?void 0:h.querySelectorAll("[data-tree-path]"))??[]).find($=>$.dataset.treePath===e);j==null||j.scrollIntoView({block:"center",inline:"nearest"})};requestAnimationFrame(()=>requestAnimationFrame(g))},[x,m,G,f==null?void 0:f.path]);l.useEffect(()=>{!d||!b||J.current!==b.requestId&&(J.current=b.requestId,C.current=b.requestId,X(b.path,b.requestId))},[d,X,b==null?void 0:b.requestId]),l.useEffect(()=>W("fs:event",e=>{for(const r of e.events??[]){const t=r.path;t===c&&window.dispatchEvent(new CustomEvent("file-changed",{detail:t}));const n=t.slice(0,t.lastIndexOf("/"))||"/",a=v.current.get(n);a!=null&&a.expanded&&a.children&&!a.loading&&N(n,a.depth).catch(()=>{})}}),[W,c,N]);const q=(e,r)=>e.endsWith("/")?e+r:`${e}/${r}`,P=w.trim().toLowerCase(),Q=(e,r)=>{var a;if(!P||r.name.toLowerCase().includes(P))return!0;if(!r.dir)return!1;const t=q(e,r.name),n=(a=v.current.get(t))==null?void 0:a.children;return(n==null?void 0:n.some(g=>Q(t,g)))??!1},U=(e,r,t)=>r.filter(n=>Q(e,n)).map(n=>{const a=q(e,n.name);if(n.dir){const h=v.current.get(a),$=(h==null?void 0:h.expanded)??!1;return s.jsxs("div",{children:[s.jsxs("div",{className:"tree-row",onClick:()=>V(a),style:{paddingLeft:6+t*12},children:[s.jsx("span",{className:"tree-disclosure","aria-hidden":"true",children:h!=null&&h.loading?s.jsx(Z,{className:"tree-spin",size:13}):$?s.jsx(_,{size:13}):s.jsx(S,{size:13})}),s.jsx("span",{className:"tree-entry-icon tree-folder-icon","aria-hidden":"true",children:$?s.jsx(T,{size:16}):s.jsx(Y,{size:16})}),s.jsx("span",{className:"tree-entry-name",children:n.name})]}),$&&(h.error?s.jsx("div",{className:"tree-error",role:"alert",style:{paddingLeft:22+t*12},children:h.error}):h.children?U(a,h.children,t+1):s.jsx("div",{className:"tree-row",style:{paddingLeft:22+t*12,color:"#556"},children:"…"}))]},a)}const g=De(n.name),j=g.icon;return s.jsxs("div",{className:"tree-row","data-tree-path":a,"data-selected":a===c?"1":void 0,onClick:()=>p(a),title:`${g.label} · ${a} · ${ee(n.size)}`,style:{paddingLeft:6+t*12},children:[s.jsx("span",{className:"tree-disclosure","aria-hidden":"true"}),s.jsx("span",{className:"tree-entry-icon",style:{color:g.color},"aria-hidden":"true",children:s.jsx(j,{size:16,strokeWidth:1.8})}),s.jsx("span",{className:"tree-entry-name",children:n.name}),s.jsx("span",{className:"tree-size",children:ee(n.size)})]},a)});if(!f)return s.jsx("div",{style:{padding:14,fontSize:12,color:"#556"},children:k?d?"等待终端目录…":"连接中…":"…"});const o=v.current.get(f.path);return s.jsxs("div",{className:"tree-scroll",ref:H,children:[s.jsxs("div",{className:"tree-location",children:[s.jsx("input",{value:O,onChange:e=>B(e.target.value),onKeyDown:e=>{e.key==="Enter"&&K()},placeholder:"输入目录路径","aria-label":"文件树目录路径",spellCheck:!1}),s.jsx("button",{tabIndex:-1,onClick:K,title:"定位目录","aria-label":"定位目录",children:s.jsx($e,{size:14,"aria-hidden":"true"})}),s.jsx("button",{tabIndex:-1,onClick:ie,title:"跟随终端目录","aria-label":"跟随终端目录","data-active":k?"1":void 0,children:s.jsx(ke,{size:14,"aria-hidden":"true"})})]}),s.jsxs("div",{className:"tree-filter",children:[s.jsx(de,{size:14,"aria-hidden":"true"}),s.jsx("input",{value:w,onChange:e=>M(e.target.value),placeholder:"筛选已加载文件","aria-label":"筛选文件树"}),w&&s.jsx("button",{tabIndex:-1,onClick:()=>M(""),"aria-label":"清除筛选",children:s.jsx(ye,{size:13,"aria-hidden":"true"})})]}),s.jsxs("div",{className:"tree-row",onClick:()=>V(f.path),children:[s.jsx("span",{className:"tree-disclosure","aria-hidden":"true",children:o!=null&&o.loading?s.jsx(Z,{className:"tree-spin",size:13}):o!=null&&o.expanded?s.jsx(_,{size:13}):s.jsx(S,{size:13})}),s.jsx("span",{className:"tree-entry-icon tree-folder-icon","aria-hidden":"true",children:o!=null&&o.expanded?s.jsx(T,{size:16}):s.jsx(Y,{size:16})}),s.jsx("span",{className:"tree-entry-name",style:{direction:"rtl",textAlign:"left"},children:f.path})]}),(o==null?void 0:o.expanded)&&(o.error?s.jsx("div",{className:"tree-error",role:"alert",children:o.error}):o.children?U(f.path,o.children,1):s.jsx("div",{className:"tree-row",style:{paddingLeft:24,color:"#556"},children:"…"}))]})}export{Be as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./index-CTJNAMck.js";import{F as d}from"./FilePreview-EGUAbGpH.js";import m from"./FileTree-aJGl1V0W.js";import{X as f}from"./x-CeSbythI.js";import"./artifact-links-4m1A00GO.js";import"./rotate-ccw-CFIRtbUD.js";import"./loader-circle-CZdAfU-D.js";import"./trash-2-DLDxY6J7.js";import"./check-BdadwkYj.js";import"./download-COWHIKec.js";import"./file-types-0e-tNIVd.js";import"./locate-fixed-ByJuEKxC.js";import"./chevron-down-DwzPFeq8.js";import"./chevron-right-kcIXzCMb.js";function z({open:a,tab:s,gateway:r,cwd:l,selectedPath:i,revealRequest:p,onTabChange:o,onSelectPath:t,onClose:n}){return a?e.jsxs("section",{className:`desktop-file-workspace${i?" has-preview":""}`,"aria-label":"我的文件",children:[e.jsxs("aside",{className:"desktop-file-drawer",children:[e.jsxs("header",{className:"desktop-file-drawer-header",children:[e.jsxs("div",{className:"desktop-file-drawer-tabs",role:"tablist","aria-label":"文件工作区视图",children:[e.jsx("button",{type:"button",role:"tab","aria-selected":s==="files",className:s==="files"?"is-active":"",onClick:()=>o("files"),children:"文件"}),e.jsx("button",{type:"button",role:"tab","aria-selected":s==="history",className:s==="history"?"is-active":"",onClick:()=>o("history"),children:"历史"})]}),e.jsx("button",{type:"button",className:"desktop-file-workspace-close ui-icon-button ui-icon-button--small",onClick:n,"aria-label":"关闭我的文件",title:"关闭",children:e.jsx(f,{size:15,"aria-hidden":"true"})})]}),s==="files"?l?e.jsx(m,{gateway:r,ready:!0,followCwd:!0,cwd:l,onOpenFile:c=>t(c),selectedPath:i,revealRequest:p}):e.jsx("div",{className:"desktop-file-workspace-empty",children:"请先选择一个项目目录"}):e.jsxs("div",{className:"desktop-file-workspace-empty",children:[e.jsx("strong",{children:"终端历史在 Web 控制台中可用"}),e.jsx("span",{children:"Electron 当前没有终端上下文,因此不会提供填入或执行操作。"})]}),e.jsxs("footer",{className:"desktop-file-drawer-footer",children:[e.jsx("span",{}),"实时同步"]})]}),i&&e.jsx("div",{className:"desktop-file-preview",children:e.jsx(d,{path:i,gateway:r,onClose:()=>t(null)})})]}):null}export{z as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{r as a,d as f,j as e}from"./index-CTJNAMck.js";import{F as w}from"./page-9-9EC7QM.js";import{R as y}from"./rotate-cw-B_vFqNsz.js";import"./RunningSessionsIcon-DmCYwIYD.js";import"./x-CeSbythI.js";import"./chevron-down-DwzPFeq8.js";import"./check-BdadwkYj.js";import"./trash-2-DLDxY6J7.js";import"./external-link-T3kil1jt.js";import"./chevron-right-kcIXzCMb.js";import"./calendar-days-BeI09qof.js";import"./artifact-links-4m1A00GO.js";import"./clipboard-BvwmdR4z.js";import"./pin-2YlrlSJv.js";import"./CollaborationTabBridge-Dxq4G1Uk.js";import"./SessionDashboardBridge-BPsNDY5Y.js";import"./RemoteDesktopTabBridge-Cp9mLtcY.js";const g=new Set(["127.0.0.1","localhost","[::1]"]);function h(s,t){const o=new URL(s),r=new URL(t);return g.has(o.hostname)&&o.hostname!==r.hostname&&(o.hostname=r.hostname),o.toString()}function I({visible:s}){const[t,o]=a.useState(null),[r,n]=a.useState("loading"),[u,m]=a.useState(0);a.useEffect(()=>{if(!s||t)return;let i=!1;return n("loading"),fetch("/api/flow-studio/config",{credentials:"same-origin"}).then(async d=>{if(!d.ok)throw new Error("Flow Studio config request failed");const c=await d.json();if(!c.entryUrl)throw new Error("Flow Studio entry is not configured");const l=new URL(c.entryUrl);if(l.protocol!=="http:"&&l.protocol!=="https:")throw new Error("Flow Studio entry URL is invalid");i||o(h(l.toString(),f()))}).catch(()=>{i||n("error")}),()=>{i=!0}},[u,t,s]),a.useEffect(()=>{if(!t||r!=="loading")return;const i=window.setTimeout(()=>n("error"),3e4);return()=>window.clearTimeout(i)},[t,r]);const p=()=>{o(null),n("loading"),m(i=>i+1)};return e.jsxs("div",{style:{position:"absolute",inset:0,background:"var(--ui-term-col-bg, #101014)"},"aria-busy":r==="loading",children:[t&&e.jsx("iframe",{src:t,title:"Flow Studio 数字人",referrerPolicy:"no-referrer",allow:"camera; microphone; autoplay; clipboard-read; clipboard-write; fullscreen",allowFullScreen:!0,onLoad:()=>n("ready"),onError:()=>n("error"),className:r==="ready"?"flow-frame flow-frame-ready":"flow-frame",style:{display:"block",width:"100%",height:"100%",border:0,background:"var(--ui-term-col-bg, #101014)"}},t),r==="loading"&&e.jsx(w,{}),r==="error"&&e.jsxs("div",{role:r==="error"?"alert":"status","aria-live":"polite",style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:10,color:"var(--ui-text, #e5e7eb)",background:"var(--ui-term-col-bg, #101014)"},children:[e.jsx("strong",{children:r==="error"?"无法打开 Flow Studio":"正在打开 Flow Studio"}),r==="error"&&e.jsxs("button",{type:"button","aria-label":"重试加载 Flow Studio",onClick:p,title:"重新加载 Flow Studio",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6,width:"auto",height:32,padding:"0 10px",border:"1px solid var(--ui-muted-border, #3b3d46)",borderRadius:6,background:"transparent",color:"inherit",cursor:"pointer"},children:[e.jsx(y,{size:16,"aria-hidden":"true"}),e.jsx("span",{children:"重试"})]})]}),e.jsx("style",{jsx:!0,children:`
|
|
2
|
+
.flow-frame { opacity: 0; transform: translateY(8px) scale(.995); transition: opacity 420ms ease, transform 520ms cubic-bezier(.2,.8,.2,1); }
|
|
3
|
+
.flow-frame-ready { opacity: 1; transform: none; }
|
|
4
|
+
@media (prefers-reduced-motion: reduce) { .flow-frame { transform: none; transition: none; } }
|
|
5
|
+
`})]})}export{I as default,h as resolveFlowStudioFrameUrl};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as n,a as D,j as e,R,P as z}from"./index-CTJNAMck.js";import{F as B,D as H,P as I,a as K,b as M,c as T,d as J,N as W,e as O,f as V,g as X,h as q,i as G,j as Q}from"./file-types-0e-tNIVd.js";import{X as U}from"./x-CeSbythI.js";import{A as Y}from"./trash-2-DLDxY6J7.js";import{C as Z}from"./chevron-right-kcIXzCMb.js";const _={folder:{icon:G,label:"文件夹"},code:{icon:q,label:"代码文件"},style:{icon:z,label:"样式文件"},image:{icon:X,label:"图片文件"},video:{icon:V,label:"视频文件"},audio:{icon:O,label:"音频文件"},markdown:{icon:W,label:"Markdown 文件"},text:{icon:J,label:"文本文件"},json:{icon:T,label:"JSON 文件"},archive:{icon:M,label:"压缩文件"},spreadsheet:{icon:K,label:"表格文件"},presentation:{icon:I,label:"演示文件"},database:{icon:H,label:"数据库文件"},file:{icon:B,label:"文件"}};function ee(a,d){return d==="directory"?"folder":Q(a)}const x=a=>a.replace(/\\/g,"/").replace(/\/+$/,"")||"/";function te(a,d){for(const l of d){if(!(l!=null&&l.trim()))continue;const h=x(l);if(h.split("/").some(o=>o==="."||o===".."))continue;const p=a.map(x).filter(o=>h===o||h.startsWith(o==="/"?"/":`${o}/`)).sort((o,c)=>c.length-o.length)[0];if(p)return{root:p,current:h}}const s=a[0]?x(a[0]):"";return{root:s,current:s}}function se(a,d){const s=x(a),l=x(d),p=[{label:s==="/"?"/":s.split("/").filter(Boolean).pop()||s,path:s}];if(l===s)return p;const o=l.slice(s==="/"?1:s.length+1);let c=s;for(const i of o.split("/").filter(Boolean))c=c==="/"?`/${i}`:`${c}/${i}`,p.push({label:i,path:c});return p}function ce({open:a,initialPath:d,onCancel:s,onConfirm:l}){const[h,p]=n.useState([]),[o,c]=n.useState(""),[i,y]=n.useState(""),[E,g]=n.useState([]),[b,k]=n.useState(!1),[F,u]=n.useState(""),[v,P]=n.useState(!1),[C,w]=n.useState(!1),m=n.useMemo(()=>o&&i?se(o,i):[],[o,i]),j=async t=>{if(window.agentApi){k(!0),w(!1),u(""),y(t),g([]);try{const r=await window.agentApi.listProjectDirectories(t);g(r),w(!0)}catch(r){u(r instanceof Error?r.message:"无法读取目录")}finally{k(!1)}}};if(n.useEffect(()=>{if(!a||!window.agentApi)return;let t=!1;return k(!0),u(""),c(""),y(""),w(!1),g([]),window.agentApi.getProjectPickerLocation().then(async({roots:r,initialPath:N})=>{if(t)return;p(r);const f=te(r,[d,N]);c(f.root),f.current?await j(f.current):u("未配置可用的宿主机目录")}).catch(r=>{t||u(r instanceof Error?r.message:"无法读取宿主机目录")}).finally(()=>{t||k(!1)}),()=>{t=!0}},[a,d]),n.useEffect(()=>{if(!a)return;const t=r=>{r.key==="Escape"&&s()};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[a,s]),!a)return null;const S=t=>{c(t),j(t)},$=()=>{m.length<=1||j(m[m.length-2].path)},A=async()=>{if(!(!i||!C||v)){P(!0),u("");try{await l(i)}catch(t){u(t instanceof Error?t.message:"项目导入失败")}finally{P(!1)}}};return D.createPortal(e.jsx("div",{className:"host-project-picker-backdrop",role:"presentation",onMouseDown:t=>{t.target===t.currentTarget&&s()},children:e.jsxs("section",{className:"host-project-picker",role:"dialog","aria-modal":"true","aria-labelledby":"host-project-picker-title",children:[e.jsxs("header",{className:"host-project-picker-header",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"host-project-picker-title",children:"选择宿主机项目"}),e.jsx("p",{children:"文件将直接在运行 AgentRoam 的机器上读写"})]}),e.jsx("button",{type:"button",className:"ui-icon-button",onClick:s,"aria-label":"关闭目录选择器",title:"关闭",children:e.jsx(U,{size:16,"aria-hidden":"true"})})]}),h.length>1&&e.jsxs("label",{className:"host-project-picker-root",children:[e.jsx("span",{children:"根目录"}),e.jsx("select",{value:o,onChange:t=>S(t.target.value),children:h.map(t=>e.jsx("option",{value:t,children:t},t))})]}),e.jsxs("nav",{className:"host-project-picker-nav","aria-label":"当前目录",children:[e.jsx("button",{type:"button",className:"ui-icon-button",onClick:$,disabled:m.length<=1,"aria-label":"返回上级目录",title:"返回上级目录",children:e.jsx(Y,{size:16,"aria-hidden":"true"})}),e.jsxs("div",{className:"host-project-picker-breadcrumbs",children:[!i&&e.jsx("span",{children:b?"正在定位工作目录…":"未能加载工作目录"}),m.map((t,r)=>e.jsxs("span",{children:[r>0&&e.jsx("i",{children:"/"}),e.jsx("button",{type:"button",onClick:()=>void j(t.path),children:t.label})]},t.path))]}),e.jsx("button",{type:"button",className:"ui-icon-button",onClick:()=>i&&void j(i),disabled:!i||b,"aria-label":"刷新目录",title:"刷新目录",children:e.jsx(R,{size:15,"aria-hidden":"true"})})]}),o==="/"&&e.jsx("div",{className:"host-project-picker-warning",children:"当前允许访问宿主机根目录,请谨慎选择项目。"}),e.jsx("div",{className:"host-project-picker-list","aria-busy":b,children:b?e.jsx("div",{className:"host-project-picker-state",children:"正在读取目录…"}):F?e.jsx("div",{className:"host-project-picker-state is-error",children:F}):E.length===0?e.jsx("div",{className:"host-project-picker-state",children:"此目录为空"}):E.map(t=>{const r=ee(t.name,t.kind),{icon:N,label:f}=_[r],L=e.jsxs(e.Fragment,{children:[e.jsx("span",{className:`host-project-picker-entry-icon is-${r}`,"aria-hidden":"true",children:e.jsx(N,{size:18,strokeWidth:1.8})}),e.jsx("span",{className:"host-project-picker-name",children:t.name})]});return t.kind==="file"?e.jsx("div",{className:"host-project-picker-row is-file",title:f,children:L},`${t.name}:${t.path}`):e.jsxs("button",{type:"button",className:"host-project-picker-row is-directory",onClick:()=>void j(t.path),title:f,children:[L,t.hasChildren&&e.jsx("span",{className:"host-project-picker-chevron","aria-hidden":"true",children:e.jsx(Z,{size:16})})]},`${t.name}:${t.path}`)})}),e.jsxs("footer",{className:"host-project-picker-footer",children:[e.jsx("code",{title:i,children:i}),e.jsxs("div",{children:[e.jsx("button",{type:"button",className:"host-project-picker-cancel",onClick:s,children:"取消"}),e.jsx("button",{type:"button",className:"host-project-picker-confirm",disabled:!i||!C||b||v,onClick:()=>void A(),children:v?"正在导入…":"选择此文件夹"})]})]})]})}),document.body)}export{ce as H};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as l,j as e}from"./index-
|
|
1
|
+
import{r as l,j as e}from"./index-CTJNAMck.js";const L=[{label:"TypeScript / JavaScript",language:"typescript",fileTypes:".ts,.tsx,.js,.jsx",command:"typescript-language-server",args:"--stdio"},{label:"Python (pylsp)",language:"python",fileTypes:".py",command:"pylsp",args:""},{label:"Python (pyright)",language:"python",fileTypes:".py",command:"pyright-langserver",args:"--stdio"},{label:"Rust (rust-analyzer)",language:"rust",fileTypes:".rs",command:"rust-analyzer",args:""},{label:"Go (gopls)",language:"go",fileTypes:".go",command:"gopls",args:""},{label:"C/C++ (clangd)",language:"cpp",fileTypes:".c,.cpp,.cc,.h,.hpp",command:"clangd",args:""},{label:"Java (jdtls via brew)",language:"java",fileTypes:".java",command:"jdtls",args:"--data /tmp/jdtls-workspace"}],y={id:"",name:"",language:"",fileTypes:"",command:"",args:"",envRaw:""};function P(){const[v,w]=l.useState([]),[t,o]=l.useState(y),[x,h]=l.useState(!1),[d,m]=l.useState(null),[f,b]=l.useState(null),g=async()=>{var n;if((n=window.agentApi)!=null&&n.lspList)try{const a=await window.agentApi.lspList();w(a)}catch(a){console.error("[LSP] load error",a)}};l.useEffect(()=>{g()},[]);const k=n=>{o(a=>({...a,name:n.label,language:n.language,fileTypes:n.fileTypes,command:n.command,args:n.args}))},T=n=>{m(n.id),o({id:n.id,name:n.name,language:n.language,fileTypes:n.fileTypes.join(","),command:n.command,args:n.args.join(" "),envRaw:n.env?Object.entries(n.env).map(([a,r])=>`${a}=${r}`).join(`
|
|
2
2
|
`):""}),b(null)},j=()=>{m(null),o(y)},R=async()=>{var S;if(!((S=window.agentApi)!=null&&S.lspSave))return;const n=t.name.trim(),a=t.command.trim();if(!n||!a)return;let r;if(t.envRaw.trim()){r={};for(const p of t.envRaw.split(`
|
|
3
3
|
`)){const u=p.indexOf("=");u>0&&(r[p.slice(0,u).trim()]=p.slice(u+1).trim())}}const F={id:d??crypto.randomUUID(),name:n,language:t.language.trim(),fileTypes:t.fileTypes.split(",").map(p=>p.trim()).filter(Boolean),command:a,args:t.args.trim()?t.args.trim().split(/\s+/):[],env:r,enabled:!0};h(!0);try{await window.agentApi.lspSave(F),await g(),j()}finally{h(!1)}},z=async n=>{var a;(a=window.agentApi)!=null&&a.lspDelete&&confirm("删除此 LSP 服务器配置?")&&(await window.agentApi.lspDelete(n),await g())},C=async n=>{var a;(a=window.agentApi)!=null&&a.lspSetEnabled&&(await window.agentApi.lspSetEnabled(n.id,!n.enabled),await g())},c=d!==null;return c&&d===null||!d&&t.name,e.jsxs("div",{style:{padding:"40px 48px",maxWidth:720,animation:"fadeInUp 0.4s var(--ease-out)"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:24},children:[e.jsxs("div",{children:[e.jsx("h2",{style:{fontSize:20,fontWeight:600,color:"var(--text-primary)",margin:0},children:"LSP 服务器"}),e.jsxs("p",{style:{fontSize:13,color:"var(--text-muted)",margin:"4px 0 0"},children:["配置 Language Server Protocol 服务器,让 Agent 可通过"," ",e.jsx("code",{style:{fontFamily:"var(--font-mono, monospace)",fontSize:12,color:"var(--text-secondary)",background:"var(--bg-deep)",padding:"1px 5px",borderRadius:4},children:"lsp_diagnostics"}),"、",e.jsx("code",{style:{fontFamily:"var(--font-mono, monospace)",fontSize:12,color:"var(--text-secondary)",background:"var(--bg-deep)",padding:"1px 5px",borderRadius:4},children:"lsp_hover"}),"、",e.jsx("code",{style:{fontFamily:"var(--font-mono, monospace)",fontSize:12,color:"var(--text-secondary)",background:"var(--bg-deep)",padding:"1px 5px",borderRadius:4},children:"lsp_definition"})," ","等工具进行代码分析。"]})]}),!c&&e.jsx("button",{onClick:()=>{m(""),o(y)},style:{padding:"8px 16px",borderRadius:"var(--radius-sm)",border:"none",background:"var(--accent)",color:"#fff",fontSize:13,fontWeight:600,cursor:"pointer",flexShrink:0},children:"+ 添加服务器"})]}),v.length===0&&!c&&e.jsx("div",{style:{color:"var(--text-muted)",fontSize:14,padding:"40px 0",textAlign:"center"},children:"尚未配置任何 LSP 服务器"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8,marginBottom:c?24:0},children:v.map(n=>e.jsxs("div",{style:{background:"var(--bg-glass)",border:"1px solid var(--border-subtle)",borderRadius:"var(--radius-md)",overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"12px 16px",cursor:"pointer"},onClick:()=>b(f===n.id?null:n.id),children:[e.jsx("div",{onClick:a=>{a.stopPropagation(),C(n)},style:{width:32,height:18,borderRadius:9,background:n.enabled?"var(--success, #34d399)":"var(--border-default)",position:"relative",cursor:"pointer",flexShrink:0,transition:"background 0.2s"},children:e.jsx("div",{style:{position:"absolute",top:2,left:n.enabled?16:2,width:14,height:14,borderRadius:"50%",background:"#fff",transition:"left 0.2s"}})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontWeight:500,fontSize:13,color:"var(--text-primary)"},children:n.name}),e.jsxs("div",{style:{fontSize:11,color:"var(--text-muted)",marginTop:2},children:[n.language,n.fileTypes.length>0?` · ${n.fileTypes.join(", ")}`:""]})]}),e.jsxs("div",{style:{fontSize:11,color:"var(--text-muted)",fontFamily:"var(--font-mono, monospace)",flexShrink:0},children:[n.command,n.args.length?" "+n.args.join(" "):""]}),e.jsx("button",{onClick:a=>{a.stopPropagation(),T(n)},style:{background:"none",border:"none",cursor:"pointer",color:"var(--text-muted)",fontSize:13,padding:"2px 8px",fontFamily:"var(--font-body)"},children:"编辑"}),e.jsx("button",{onClick:a=>{a.stopPropagation(),z(n.id)},style:{background:"none",border:"none",cursor:"pointer",color:"var(--danger, #f43f5e)",fontSize:13,padding:"2px 8px",fontFamily:"var(--font-body)"},children:"删除"}),e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-muted)",strokeWidth:"2.5",strokeLinecap:"round",style:{flexShrink:0,transition:"transform 0.2s",transform:f===n.id?"rotate(180deg)":"none"},children:e.jsx("path",{d:"M6 9l6 6 6-6"})})]}),f===n.id&&e.jsxs("div",{style:{padding:"12px 16px",fontSize:12,color:"var(--text-muted)",borderTop:"1px solid var(--border-subtle)",display:"flex",flexDirection:"column",gap:6},children:[e.jsxs("div",{children:[e.jsx("span",{style:{color:"var(--text-secondary)",fontWeight:500},children:"命令:"}),e.jsxs("code",{style:{fontFamily:"var(--font-mono, monospace)",background:"var(--bg-deep)",padding:"1px 5px",borderRadius:4},children:[n.command," ",n.args.join(" ")]})]}),n.fileTypes.length>0&&e.jsxs("div",{children:[e.jsx("span",{style:{color:"var(--text-secondary)",fontWeight:500},children:"文件类型:"}),n.fileTypes.join(", ")]}),n.env&&Object.keys(n.env).length>0&&e.jsxs("div",{children:[e.jsx("span",{style:{color:"var(--text-secondary)",fontWeight:500},children:"环境变量:"}),Object.entries(n.env).map(([a,r])=>`${a}=${r}`).join(", ")]})]})]},n.id))}),c&&e.jsxs("div",{style:{padding:"20px 24px",borderRadius:"var(--radius-md)",border:"1px solid var(--border-glow)",background:"var(--bg-glass)"},children:[e.jsx("h3",{style:{margin:"0 0 16px",fontSize:14,fontWeight:600,color:"var(--text-primary)"},children:d?"编辑 LSP 服务器":"添加 LSP 服务器"}),e.jsxs("div",{style:{marginBottom:16},children:[e.jsx("label",{style:i,children:"快速预设"}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:L.map(n=>e.jsx("button",{onClick:()=>k(n),style:{background:"var(--bg-deep)",border:"1px solid var(--border-default)",borderRadius:"var(--radius-sm)",padding:"4px 10px",fontSize:11,cursor:"pointer",color:"var(--text-secondary)",fontFamily:"var(--font-body)"},children:n.label},n.label))})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[e.jsxs("div",{children:[e.jsxs("label",{style:i,children:["名称 ",e.jsx("span",{style:{color:"var(--danger, #f43f5e)",textTransform:"none"},children:"*"})]}),e.jsx("input",{value:t.name,onChange:n=>o(a=>({...a,name:n.target.value})),placeholder:"TypeScript Language Server",style:s})]}),e.jsxs("div",{children:[e.jsx("label",{style:i,children:"语言"}),e.jsx("input",{value:t.language,onChange:n=>o(a=>({...a,language:n.target.value})),placeholder:"typescript",style:s})]})]}),e.jsxs("div",{children:[e.jsxs("label",{style:i,children:["文件类型",e.jsx("span",{style:{textTransform:"none",letterSpacing:0,fontWeight:400,marginLeft:6,color:"var(--text-muted)"},children:"逗号分隔,如 .ts,.tsx"})]}),e.jsx("input",{value:t.fileTypes,onChange:n=>o(a=>({...a,fileTypes:n.target.value})),placeholder:".ts,.tsx,.js,.jsx",style:s})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[e.jsxs("div",{children:[e.jsxs("label",{style:i,children:["命令 ",e.jsx("span",{style:{color:"var(--danger, #f43f5e)",textTransform:"none"},children:"*"})]}),e.jsx("input",{value:t.command,onChange:n=>o(a=>({...a,command:n.target.value})),placeholder:"typescript-language-server",style:{...s,fontFamily:"var(--font-mono, monospace)"}})]}),e.jsxs("div",{children:[e.jsxs("label",{style:i,children:["参数",e.jsx("span",{style:{textTransform:"none",letterSpacing:0,fontWeight:400,marginLeft:6,color:"var(--text-muted)"},children:"空格分隔"})]}),e.jsx("input",{value:t.args,onChange:n=>o(a=>({...a,args:n.target.value})),placeholder:"--stdio",style:{...s,fontFamily:"var(--font-mono, monospace)"}})]})]}),e.jsxs("div",{children:[e.jsxs("label",{style:i,children:["环境变量",e.jsx("span",{style:{textTransform:"none",letterSpacing:0,fontWeight:400,marginLeft:6,color:"var(--text-muted)"},children:"每行 KEY=VALUE"})]}),e.jsx("textarea",{value:t.envRaw,onChange:n=>o(a=>({...a,envRaw:n.target.value})),placeholder:`NODE_ENV=production
|
|
4
4
|
TSPROTOCOL_LOG=verbose`,rows:3,style:{...s,fontFamily:"var(--font-mono, monospace)",resize:"vertical"}})]}),t.language==="java"&&e.jsxs("div",{style:{background:"rgba(234,179,8,0.08)",border:"1px solid rgba(234,179,8,0.3)",borderRadius:"var(--radius-sm)",padding:"10px 14px",fontSize:12,color:"var(--text-secondary)",lineHeight:1.65},children:[e.jsx("strong",{style:{color:"rgba(202,138,4,1)"},children:"Java 提示:"})," ","使用 ",e.jsx("code",{style:{fontFamily:"var(--font-mono, monospace)",background:"var(--bg-deep)",padding:"1px 5px",borderRadius:3},children:"jdtls"})," 预设需先通过"," ",e.jsx("code",{style:{fontFamily:"var(--font-mono, monospace)",background:"var(--bg-deep)",padding:"1px 5px",borderRadius:3},children:"brew install jdtls"})," ","安装包装脚本。若手动安装,请将命令改为"," ",e.jsx("code",{style:{fontFamily:"var(--font-mono, monospace)",background:"var(--bg-deep)",padding:"1px 5px",borderRadius:3},children:"java"}),", 并在参数中填入完整的 JVM 参数和"," ",e.jsx("code",{style:{fontFamily:"var(--font-mono, monospace)",background:"var(--bg-deep)",padding:"1px 5px",borderRadius:3},children:"-jar .../launcher.jar -data /path/to/workspace"}),"。"]})]}),e.jsxs("div",{style:{display:"flex",gap:8,marginTop:20},children:[e.jsx("button",{onClick:()=>void R(),disabled:x||!t.name.trim()||!t.command.trim(),style:{padding:"8px 20px",borderRadius:"var(--radius-sm)",border:"none",background:"var(--accent)",color:"#fff",fontSize:13,fontWeight:600,cursor:"pointer",opacity:x||!t.name.trim()||!t.command.trim()?.45:1,fontFamily:"var(--font-body)"},children:x?"保存中…":"保存"}),e.jsx("button",{onClick:j,style:{padding:"8px 20px",borderRadius:"var(--radius-sm)",border:"1px solid var(--border-default)",background:"transparent",color:"var(--text-secondary)",fontSize:13,fontWeight:600,cursor:"pointer",fontFamily:"var(--font-body)"},children:"取消"})]})]})]})}const s={width:"100%",padding:"8px 10px",borderRadius:"var(--radius-sm)",border:"1px solid var(--border-default)",background:"var(--bg-glass)",color:"var(--text-primary)",fontSize:13,fontFamily:"var(--font-body)",outline:"none",boxSizing:"border-box"},i={fontSize:11,color:"var(--text-muted)",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",marginBottom:4,display:"block"};export{P as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as d,j as t}from"./index-
|
|
1
|
+
import{r as d,j as t}from"./index-CTJNAMck.js";const B={id:"",name:"",command:"",args:"",url:"",headersRaw:""};function oe(){const[S,f]=d.useState([]),[s,U]=d.useState("stdio"),[a,u]=d.useState(B),[T,I]=d.useState(!1),[g,b]=d.useState({id:!1,command:!1,url:!1}),[j,W]=d.useState({}),[E,H]=d.useState({}),[_,P]=d.useState(new Set),[p,v]=d.useState(null),[x,w]=d.useState(""),[k,D]=d.useState(!1),y=async e=>{var i;if(!((i=window.agentApi)!=null&&i.mcpProbe))return;P(n=>new Set([...n,e.id])),H(n=>{const o={...n};return delete o[e.id],o});const r=new Promise((n,o)=>setTimeout(()=>o(new Error("连接超时(15s)")),15e3));try{const n=await Promise.race([window.agentApi.mcpProbe(e),r]);W(o=>({...o,[e.id]:n}))}catch(n){const o=n instanceof Error?n.message:String(n);console.warn(`[MCP] probe failed for ${e.id}:`,o),W(l=>{const F={...l};return delete F[e.id],F}),H(l=>({...l,[e.id]:o})),(e.transport==="sse"||/401|403|unauthorized|forbidden|需要认证|访问被拒绝/i.test(o))&&(w(""),v({server:e}))}finally{P(n=>{const o=new Set(n);return o.delete(e.id),o})}};d.useEffect(()=>{window.agentApi&&window.agentApi.mcpList().then(e=>{f(e),e.filter(r=>r.enabled!==!1).forEach(r=>y(r))}).catch(console.error)},[]);const[h,L]=d.useState(""),[M,z]=d.useState(""),[C,O]=d.useState(!1),V=async()=>{z("");let e;try{e=JSON.parse(h.trim());const r=e.mcpServers??e,i=Object.entries(r);if(i.length===0){z("未找到任何服务器");return}O(!0);const n=[];for(const[l,F]of i){const c=F,J=c.name||l,N=c.disabled!==!0;let R;if(c.url||c.type==="streamableHttp"||c.type==="sse"){const re=c.type==="sse"?"sse":"streamableHttp";R={id:l,name:J,transport:re,url:c.url,headers:c.headers??{},env:c.env??{},enabled:N}}else R={id:l,name:J,transport:"stdio",command:c.command,args:c.args??[],env:c.env??{},enabled:N};await window.agentApi.mcpSave(R),n.push(R)}const o=await window.agentApi.mcpList();f(o),L(""),n.filter(l=>l.enabled!==!1).forEach(l=>y(l))}catch(r){z(r instanceof Error?r.message:"JSON 解析失败")}finally{O(!1)}},K=()=>a.id.trim()!==""&&a.command.trim()!=="",Y=()=>a.id.trim()!==""&&a.url.trim()!=="",q=e=>{const r={};for(const i of e.split(`
|
|
2
2
|
`)){const n=i.indexOf(":");if(n<1)continue;const o=i.slice(0,n).trim(),l=i.slice(n+1).trim();o&&(r[o]=l)}return r},G=async()=>{if(b({id:!0,command:!0,url:!0}),!(s==="stdio"&&!K())&&!((s==="sse"||s==="streamableHttp")&&!Y())){I(!0);try{const e=s==="sse"||s==="streamableHttp"?q(a.headersRaw):{},r=s==="stdio"?{id:a.id,name:a.name||a.id,transport:"stdio",command:a.command,args:a.args.split(" ").filter(Boolean),enabled:!0}:{id:a.id,name:a.name||a.id,transport:s,url:a.url,headers:e,enabled:!0};await window.agentApi.mcpSave(r);const i=await window.agentApi.mcpList();f(i),u(B),b({id:!1,command:!1,url:!1}),y(r)}catch(e){console.error("Failed to save MCP server",e)}finally{I(!1)}}},Q=async e=>{await window.agentApi.mcpDelete(e),f(S.filter(r=>r.id!==e))},X=async(e,r)=>{await window.agentApi.mcpSetEnabled(e,r),f(S.map(i=>i.id===e?{...i,enabled:r}:i))},$=async()=>{if(!(!p||!x.trim())){D(!0);try{const e=p.server.transport==="streamableHttp"?{...p.server,headers:{...p.server.headers??{},Authorization:`Bearer ${x.trim()}`}}:{...p.server,env:{...p.server.env??{},Authorization:`Bearer ${x.trim()}`}};await window.agentApi.mcpSave(e);const r=await window.agentApi.mcpList();f(r),v(null),w("");const i=r.find(n=>n.id===e.id)??e;y(i)}finally{D(!1)}}},Z=e=>e==="stdio"?"本地":e==="streamableHttp"?"HTTP":"SSE",ee=e=>e==="stdio"?"#68d391":e==="streamableHttp"?"#f6ad55":"#63b3ed",te=e=>e==="stdio"?"rgba(154,230,180,0.15)":e==="streamableHttp"?"rgba(246,173,85,0.15)":"rgba(99,179,237,0.15)";return t.jsxs("div",{style:{padding:"40px 48px",maxWidth:660,animation:"fadeInUp 0.4s var(--ease-out)"},children:[t.jsx("h2",{style:{fontFamily:"var(--font-display)",fontSize:28,color:"var(--text-primary)",fontWeight:400,marginBottom:8,letterSpacing:"-0.02em"},children:"MCP 服务器"}),t.jsx("p",{style:{color:"var(--text-muted)",fontSize:14,marginBottom:32},children:"通过模型上下文协议连接外部工具。"}),t.jsxs("div",{style:{padding:20,background:"var(--bg-glass)",borderRadius:"var(--radius-md)",border:"1px solid var(--border-subtle)",marginBottom:28,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:16},children:[t.jsx("h3",{style:{fontSize:14,fontWeight:600,color:"var(--text-primary)",margin:0},children:"添加服务器"}),t.jsx("div",{style:{display:"flex",background:"var(--bg-surface)",borderRadius:"var(--radius-sm)",border:"1px solid var(--border-default)",overflow:"hidden"},children:["stdio","sse","streamableHttp"].map(e=>t.jsx("button",{onClick:()=>{U(e),b({id:!1,command:!1,url:!1}),u(r=>({...B,id:r.id,name:r.name}))},style:{padding:"5px 14px",border:"none",fontSize:12,fontWeight:500,cursor:"pointer",fontFamily:"var(--font-body)",transition:"background 0.15s",background:s===e?"var(--accent)":"transparent",color:s===e?"var(--text-inverse)":"var(--text-muted)"},children:e==="stdio"?"本地 stdio":e==="sse"?"远程 SSE":"HTTP"},e))})]}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[t.jsxs("div",{style:{display:"flex",gap:10},children:[t.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:4},children:[t.jsx("input",{value:a.id,onChange:e=>u(r=>({...r,id:e.target.value})),onBlur:()=>b(e=>({...e,id:!0})),placeholder:"服务器 ID *",style:{...m,...g.id&&!a.id?A:{}}}),g.id&&!a.id&&t.jsx("span",{style:{fontSize:11,color:"var(--danger)"},children:"必填"})]}),t.jsx("input",{value:a.name,onChange:e=>u(r=>({...r,name:e.target.value})),placeholder:"显示名称",style:{...m,flex:1}})]}),s==="stdio"?t.jsxs("div",{style:{display:"flex",gap:10},children:[t.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:4},children:[t.jsx("input",{value:a.command,onChange:e=>u(r=>({...r,command:e.target.value})),onBlur:()=>b(e=>({...e,command:!0})),placeholder:"命令(如 npx)*",style:{...m,...g.command&&!a.command?A:{}}}),g.command&&!a.command&&t.jsx("span",{style:{fontSize:11,color:"var(--danger)"},children:"必填"})]}),t.jsx("input",{value:a.args,onChange:e=>u(r=>({...r,args:e.target.value})),placeholder:"参数(如 -y @anthropic/mcp-server)",style:{...m,flex:2}})]}):t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[t.jsx("input",{value:a.url,onChange:e=>u(r=>({...r,url:e.target.value})),onBlur:()=>b(e=>({...e,url:!0})),placeholder:s==="streamableHttp"?"HTTP URL(如 http://host/mcp)*":"SSE URL(如 https://mcp.example.com/sse)*",style:{...m,...g.url&&!a.url?A:{}}}),g.url&&!a.url&&t.jsx("span",{style:{fontSize:11,color:"var(--danger)"},children:"必填"})]}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[t.jsx("label",{style:{fontSize:12,color:"var(--text-muted)"},children:"请求头(每行 key: value)"}),t.jsx("textarea",{value:a.headersRaw,onChange:e=>u(r=>({...r,headersRaw:e.target.value})),placeholder:`access_token: abc123
|
|
3
3
|
Authorization: Bearer sk-...`,rows:3,style:{...m,fontFamily:"var(--font-mono)",fontSize:12,resize:"vertical"}})]})]}),t.jsx("button",{onClick:G,disabled:T,style:{alignSelf:"flex-start",padding:"10px 22px",borderRadius:"var(--radius-sm)",border:"none",background:"var(--accent)",color:"var(--text-inverse)",fontSize:13,fontWeight:600,cursor:T?"not-allowed":"pointer",fontFamily:"var(--font-body)"},children:T?"保存中…":"添加服务器"})]})]}),t.jsxs("div",{style:{marginBottom:28,padding:20,background:"var(--bg-glass)",borderRadius:"var(--radius-md)",border:"1px solid var(--border-subtle)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)"},children:[t.jsx("h3",{style:{fontSize:14,fontWeight:600,color:"var(--text-primary)",margin:"0 0 8px"},children:"导入 JSON 配置"}),t.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"0 0 10px"},children:"兼容 Claude Desktop / Cursor 格式,粘贴后点导入。"}),t.jsx("textarea",{value:h,onChange:e=>{L(e.target.value),z("")},placeholder:`{
|
|
4
4
|
"my-server": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r,j as t}from"./index-
|
|
1
|
+
import{r,j as t}from"./index-CTJNAMck.js";function E(){const[f,m]=r.useState([]),[g,B]=r.useState(""),[n,b]=r.useState(null),[h,o]=r.useState(!1),[y,a]=r.useState(""),[S,s]=r.useState(""),[j,i]=r.useState("user"),[w,d]=r.useState(""),[k,l]=r.useState(null),[v,c]=r.useState("success"),p=async()=>{if(window.agentApi){const e=await window.agentApi.listMemories();m(e)}};r.useEffect(()=>{p()},[]);const z=async()=>{if(!g.trim()){p();return}if(window.agentApi){const e=await window.agentApi.searchMemories(g);m(e.map(u=>u.entry))}},R=async()=>{if(!(!y.trim()||!window.agentApi))try{await window.agentApi.setMemory({name:y.trim(),description:S,type:j,content:w,created:(n==null?void 0:n.created)??new Date().toISOString(),updated:new Date().toISOString()}),o(!1),b(null),a(""),s(""),d(""),i("user"),l("保存成功"),c("success"),await p()}catch(e){l(e instanceof Error?e.message:"保存失败"),c("error")}},W=e=>{b(e),a(e.name),s(e.description),i(e.type),d(e.content),o(!0)};return t.jsxs("div",{style:{padding:"40px 48px",maxWidth:720,animation:"fadeInUp 0.4s var(--ease-out)"},children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:24},children:[t.jsxs("div",{children:[t.jsx("h2",{style:{fontFamily:"var(--font-display)",fontSize:28,color:"var(--text-primary)",fontWeight:400,letterSpacing:"-0.02em"},children:"记忆"}),t.jsx("p",{style:{color:"var(--text-muted)",fontSize:14,marginTop:4},children:"跨会话的持久化知识库。"})]}),t.jsx("button",{onClick:()=>{o(!0),b(null),a(""),s(""),d(""),i("user")},style:{padding:"10px 20px",borderRadius:"var(--radius-sm)",border:"none",background:"var(--accent)",color:"var(--text-inverse)",fontSize:13,fontWeight:600,cursor:"pointer",fontFamily:"var(--font-body)"},children:"+ 新建"})]}),t.jsxs("div",{style:{display:"flex",gap:8,marginBottom:24},children:[t.jsx("input",{value:g,onChange:e=>B(e.target.value),onKeyDown:e=>e.key==="Enter"&&z(),placeholder:"搜索记忆...",style:{flex:1,padding:"10px 14px",borderRadius:"var(--radius-sm)",border:"1px solid var(--border-default)",background:"var(--bg-glass)",color:"var(--text-primary)",fontSize:14,outline:"none",fontFamily:"var(--font-body)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"}}),t.jsx("button",{onClick:z,style:C,children:"搜索"})]}),k&&t.jsx("div",{style:{padding:"10px 12px",borderRadius:"var(--radius-sm)",border:v==="success"?"1px solid rgba(52,211,153,0.35)":"1px solid rgba(244,63,94,0.35)",background:v==="success"?"rgba(52,211,153,0.08)":"rgba(244,63,94,0.08)",color:v==="success"?"var(--success)":"var(--danger)",fontSize:13,marginBottom:16},children:k}),h&&t.jsxs("div",{style:{padding:20,marginBottom:24,background:"var(--bg-glass)",borderRadius:"var(--radius-md)",border:"1px solid var(--border-subtle)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)"},children:[t.jsx("input",{value:y,onChange:e=>a(e.target.value),placeholder:"名称",style:{...x,marginBottom:10},disabled:!!n}),t.jsx("input",{value:S,onChange:e=>s(e.target.value),placeholder:"描述",style:{...x,marginBottom:10}}),t.jsxs("select",{value:j,onChange:e=>i(e.target.value),style:{...x,marginBottom:10},children:[t.jsx("option",{value:"user",children:"用户"}),t.jsx("option",{value:"feedback",children:"反馈"}),t.jsx("option",{value:"project",children:"项目"}),t.jsx("option",{value:"reference",children:"参考"})]}),t.jsx("textarea",{value:w,onChange:e=>d(e.target.value),placeholder:"内容",rows:5,style:{...x,marginBottom:12,resize:"vertical"}}),t.jsxs("div",{style:{display:"flex",gap:8},children:[t.jsx("button",{onClick:R,style:{padding:"9px 20px",borderRadius:"var(--radius-sm)",border:"none",background:"var(--success)",color:"#000",fontSize:13,fontWeight:600,cursor:"pointer",fontFamily:"var(--font-body)"},children:"保存"}),t.jsx("button",{onClick:()=>o(!1),style:C,children:"取消"})]})]}),f.map(e=>t.jsxs("div",{style:{padding:"14px 16px",marginBottom:8,background:"var(--bg-glass)",borderRadius:"var(--radius-sm)",border:"1px solid var(--border-subtle)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",transition:"border-color 0.2s"},children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[t.jsx("span",{style:{color:"var(--text-primary)",fontWeight:600,fontSize:14},children:e.name}),t.jsx("span",{style:{fontSize:10,padding:"2px 8px",borderRadius:10,background:"rgba(255,255,255,0.04)",color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.06em",fontWeight:500},children:e.type})]}),t.jsxs("div",{style:{display:"flex",gap:6},children:[t.jsx("button",{onClick:()=>W(e),style:F,children:"编辑"}),t.jsx("button",{onClick:async()=>{if(window.agentApi)try{await window.agentApi.deleteMemory(e.name),l("删除成功"),c("success"),await p()}catch(u){l(u instanceof Error?u.message:"删除失败"),c("error")}},style:{...F,color:"var(--danger)"},children:"删除"})]})]}),e.description&&t.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)",marginTop:4},children:e.description}),t.jsxs("div",{style:{fontSize:12,color:"var(--text-muted)",marginTop:4,lineHeight:1.5},children:[e.content.slice(0,180),e.content.length>180?"…":""]})]},e.name)),f.length===0&&!h&&t.jsx("div",{style:{color:"var(--text-muted)",fontSize:14,padding:"60px 0",textAlign:"center"},children:"暂无记忆,点击「新建」创建一条。"})]})}const x={width:"100%",padding:"11px 14px",borderRadius:"var(--radius-sm)",border:"1px solid var(--border-default)",background:"var(--bg-surface)",color:"var(--text-primary)",fontSize:14,outline:"none",fontFamily:"var(--font-body)",boxSizing:"border-box"},C={padding:"10px 16px",borderRadius:"var(--radius-sm)",border:"1px solid var(--border-default)",background:"var(--bg-glass)",color:"var(--text-secondary)",fontSize:13,fontWeight:500,cursor:"pointer",fontFamily:"var(--font-body)"},F={padding:"4px 10px",borderRadius:6,fontSize:11,border:"none",background:"rgba(255,255,255,0.05)",color:"var(--text-secondary)",cursor:"pointer",fontFamily:"var(--font-body)",fontWeight:500};export{E as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r,u as f,j as a}from"./index-CTJNAMck.js";import{c as g,r as h,u as j,T as v,C as x}from"./new-session-window-DwtkwFBQ.js";import{X as y}from"./x-CeSbythI.js";import"./artifact-links-4m1A00GO.js";import"./composer-file-routing-DSC2Eojr.js";import"./loader-circle-CZdAfU-D.js";import"./clipboard-BvwmdR4z.js";import"./check-BdadwkYj.js";import"./RunningSessionsIcon-DmCYwIYD.js";import"./file-types-0e-tNIVd.js";import"./trash-2-DLDxY6J7.js";import"./list-todo-7yETOqQe.js";import"./chevron-right-kcIXzCMb.js";import"./chevron-down-DwzPFeq8.js";import"./arrow-right-BtIv2jiq.js";import"./zoom-out-CRr_o1NV.js";import"./rotate-ccw-CFIRtbUD.js";import"./download-COWHIKec.js";import"./play-BxEpdvoI.js";import"./HostProjectPicker-BvboCQ0a.js";function B(){const[m]=r.useState(()=>g()),[n,u]=r.useState(()=>{const e=h(window.location.search);return{agentType:(e==null?void 0:e.agentType)??"customer-agent",projectId:null,cwd:(e==null?void 0:e.workspacePath)??""}}),[t,i]=r.useState(null),[p,w]=r.useState([]),[s,c]=r.useState(""),l=f(e=>e.skin);r.useEffect(()=>{document.documentElement.setAttribute("data-skin",l)},[l]),r.useEffect(()=>{document.title=t!=null&&t.title?`${t.title} · AgentRoam`:"新建会话 · AgentRoam"},[t==null?void 0:t.title]),r.useEffect(()=>{let e=!0;return j.getState().loadFromSystem(),window.agentApi.getRuntimeHealth().then(o=>{e&&w(o)}).catch(()=>{}),()=>{e=!1}},[]);const d=async(e,o)=>{if(o){i(o);return}try{const S=await window.agentApi.getSession(e,{limit:1,view:"core"});i(S),c("")}catch{c("无法打开会话,请重试")}};return a.jsxs("main",{className:"new-session-window","aria-label":"会话小窗",children:[s&&a.jsx("div",{className:"new-session-window-error",role:"alert",children:s}),a.jsx(v,{draft:t?void 0:n,onDraftChange:u,children:a.jsx(x,{agentStore:m,desktopTaskPane:!0,activeAgentType:(t==null?void 0:t.agentType)??n.agentType,selectedProjectId:(t==null?void 0:t.projectId)??n.projectId,selectedSessionId:(t==null?void 0:t.id)??null,sessionSummary:t??void 0,sessionTitle:(t==null?void 0:t.title)??"新建会话",paneControls:a.jsx("button",{type:"button",className:"ui-icon-button new-session-window-close","aria-label":"关闭会话小窗",title:"关闭会话小窗",onClick:()=>window.close(),children:a.jsx(y,{size:17,"aria-hidden":"true"})}),workspacePath:(t==null?void 0:t.cwd)??n.cwd,runtimeHealth:p,focusComposerNonce:1,sessionCreationPending:!t&&!n.projectId,onSessionCreated:(e,o)=>d(e,o),onSelectSession:(e,o)=>{d(e,o)},onParallelSessionSelected:e=>{i(e)}})})]})}export{B as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.new-session-window{width:100%;height:100dvh;display:flex;flex-direction:column;overflow:hidden;background:var(--bg-workspace);--session-window-gutter: clamp(12px, 2.35vw, 20px)}.new-session-window .task-pane-conversation{display:flex;flex-direction:column;flex:1;min-height:0}.new-session-window .chat-view{width:100%;min-height:0;flex:1;--chat-lane-width: 100%;--chat-header-height: 44px;--chat-header-padding: 0 var(--session-window-gutter);--chat-messages-padding: 10px var(--session-window-gutter);--chat-input-padding: 0 var(--session-window-gutter)}.new-session-window-close{flex-shrink:0;-webkit-app-region:no-drag}.new-session-window .chat-input-area{flex-shrink:0}.new-session-window .composer-text-input{height:clamp(56px,15dvh,88px);min-height:0}.new-session-window .empty-session-welcome{height:100%;min-height:0;padding:8px 0}.new-session-window .empty-session-welcome__core,.new-session-window .empty-session-welcome__starters{display:none}.new-session-window .task-pane-workspace-error,.new-session-window-error{display:flex;gap:8px;padding:10px var(--session-window-gutter);color:var(--danger);font-size:12px}.new-session-window .task-pane-workspace-error button{color:var(--accent);background:transparent;cursor:pointer}
|
package/runtime/webapp/dist/assets/{RemoteDesktopPage-w8aL061W.js → RemoteDesktopPage-Cpzv8zH0.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,u as a,j as u}from"./index-
|
|
1
|
+
import{r as t,u as a,j as u}from"./index-CTJNAMck.js";import l from"./BrowserLivePanel-DkBugqrH.js";import{R as f,a as d,b as w,r as g}from"./RemoteDesktopTabBridge-Cp9mLtcY.js";import"./loader-circle-CZdAfU-D.js";import"./chevron-down-DwzPFeq8.js";import"./clipboard-BvwmdR4z.js";import"./zoom-out-CRr_o1NV.js";import"./rotate-ccw-CFIRtbUD.js";import"./x-CeSbythI.js";import"./external-link-T3kil1jt.js";function x(){const[s,n]=t.useState(!1),[m,i]=t.useState(!1),[r,p]=t.useState(a.getState().skin);t.useEffect(()=>a.subscribe(e=>p(e.skin)),[]),t.useEffect(()=>{document.documentElement.dataset.skin=r,document.body.dataset.remoteDesktop="1"},[r]),t.useEffect(()=>{const e=E=>{const o=g(E,location.origin,window.parent);o!==null&&(n(o),o&&i(!0))};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)},[]),t.useEffect(()=>{if(!s)return;const e=requestAnimationFrame(()=>{window.parent.postMessage({type:f},location.origin)});return()=>cancelAnimationFrame(e)},[s]);const c=t.useCallback(e=>{window.parent.postMessage({type:d,fullscreen:e},location.origin)},[]);return u.jsx(l,{onFullscreenChange:c,open:m,active:s,onClose:()=>{i(!1),n(!1),window.parent.postMessage({type:w},location.origin)}})}export{x as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as e}from"./index-
|
|
1
|
+
import{c as e}from"./index-CTJNAMck.js";/**
|
|
2
2
|
* @license lucide-react v0.468.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -13,17 +13,17 @@ import{c as e}from"./index-DKm9ESDq.js";/**
|
|
|
13
13
|
*
|
|
14
14
|
* This source code is licensed under the ISC license.
|
|
15
15
|
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const
|
|
16
|
+
*/const r=e("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/**
|
|
17
17
|
* @license lucide-react v0.468.0 - ISC
|
|
18
18
|
*
|
|
19
19
|
* This source code is licensed under the ISC license.
|
|
20
20
|
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const
|
|
21
|
+
*/const t=e("MessagesSquare",[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]]);/**
|
|
22
22
|
* @license lucide-react v0.468.0 - ISC
|
|
23
23
|
*
|
|
24
24
|
* This source code is licensed under the ISC license.
|
|
25
25
|
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/const
|
|
26
|
+
*/const n=e("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/**
|
|
27
27
|
* @license lucide-react v0.468.0 - ISC
|
|
28
28
|
*
|
|
29
29
|
* This source code is licensed under the ISC license.
|
|
@@ -33,4 +33,4 @@ import{c as e}from"./index-DKm9ESDq.js";/**
|
|
|
33
33
|
*
|
|
34
34
|
* This source code is licensed under the ISC license.
|
|
35
35
|
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
-
*/const o=e("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]),
|
|
36
|
+
*/const o=e("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]),x=e("RunningSessions",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"conversation"}],["path",{d:"m9 6.5 6 3.5-6 3.5z",fill:"currentColor",stroke:"none",key:"running"}]]);export{c as C,i as G,n as M,x as R,o as S,t as a,a as b,r as c};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import{c as z,r as u,a as L,j as s,h as O,m as w,u as I,R as P,e as U,A}from"./index-CTJNAMck.js";import{b as G}from"./SessionDashboardBridge-BPsNDY5Y.js";import{u as q,a as B,p as y,D as R}from"./session-dashboard-DnFhQhBN.js";import{c as C,U as S,A as N,D as _}from"./collaboration-CAgt9AiV.js";import{X as V}from"./x-CeSbythI.js";import{A as v}from"./arrow-right-BtIv2jiq.js";import{C as E}from"./chevron-down-DwzPFeq8.js";import{S as X}from"./shield-check-Btyos6Iv.js";import{P as Y}from"./play-BxEpdvoI.js";import{P as H}from"./pause-DXyBDZlg.js";/**
|
|
2
|
+
* @license lucide-react v0.468.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const T=z("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"}]]);/**
|
|
7
|
+
* @license lucide-react v0.468.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const F=z("Layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]);/**
|
|
12
|
+
* @license lucide-react v0.468.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const J=z("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);function K({title:e,message:a,onClose:t,onRetry:r}){const l=u.useRef(null),d=u.useId();return u.useEffect(()=>{const o=l.current;return o==null||o.showModal(),()=>{o!=null&&o.open&&o.close()}},[]),L.createPortal(s.jsxs("dialog",{ref:l,className:"sidebar-delete-confirmation action-error-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":`${d}-title`,"aria-describedby":`${d}-message`,onCancel:o=>{o.preventDefault(),t()},onClick:o=>{if(o.target!==o.currentTarget)return;const c=o.currentTarget.getBoundingClientRect();(o.clientX<c.left||o.clientX>c.right||o.clientY<c.top||o.clientY>c.bottom)&&t()},children:[s.jsx("strong",{id:`${d}-title`,children:e}),s.jsx("p",{id:`${d}-message`,children:a}),s.jsxs("div",{className:"sidebar-delete-confirmation-actions",children:[s.jsx("button",{type:"button",autoFocus:!0,onClick:t,children:r?"关闭":"知道了"}),r&&s.jsx("button",{type:"button",className:"is-primary",onClick:()=>{t(),r()},children:"重试"})]})]}),document.body)}const Q={notice:null,reported:{}};function W(e,a){var t;if(a.type==="dismiss")return{...e,notice:null};if(a.type==="recover"){if(!(a.source in e.reported))return e;const r={...e.reported};return delete r[a.source],{reported:r,notice:((t=e.notice)==null?void 0:t.source)===a.source?null:e.notice}}return!a.repeat&&e.reported[a.notice.source]===a.notice.message?e:{notice:a.notice,reported:{...e.reported,[a.notice.source]:a.notice.message}}}function Z(){const[e,a]=u.useReducer(W,Q),t=u.useCallback((d,o=!1)=>a({type:"report",notice:d,repeat:o}),[]),r=u.useCallback(d=>a({type:"recover",source:d}),[]),l=u.useCallback(()=>a({type:"dismiss"}),[]);return{notice:e.notice,report:t,recover:r,dismiss:l}}function ss(){const e=O(),a=q(),[t,r]=u.useState(null),{notice:l,report:d,recover:o,dismiss:c}=Z(),[b,f]=u.useState(!0),p=u.useRef(null),i=u.useRef(!0),g=u.useCallback(async(m=!0)=>{if(p.current||!w())return;const x=Symbol();p.current=x;try{const j=await C({action:"dashboard"});i.current&&p.current===x&&w()&&(r(j),j.discoveryError?d({source:"dashboard",title:"原生会话加载失败",message:j.discoveryError,onRetry:()=>void g()},m):o("dashboard"))}catch(j){i.current&&p.current===x&&w()&&d({source:"dashboard",title:"看板加载失败",message:j instanceof Error?j.message:"无法加载看板",onRetry:()=>void g()},m)}finally{p.current===x&&(p.current=null,i.current&&f(!1))}},[d,o]);return u.useEffect(()=>{if(!e)return;i.current=!0,o("dashboard"),f(!0),g(!1);const m=setInterval(()=>{w()&&g(!1)},5e3),x=()=>{g(!1)};return window.addEventListener("focus",x),()=>{i.current=!1,p.current=null,clearInterval(m),window.removeEventListener("focus",x)}},[e,g,o]),{snapshot:B(t,a),notice:l,dismissError:c,loading:b,refresh:g}}function es(){return s.jsx("div",{className:"session-dashboard-loading",role:"status","aria-live":"polite","aria-label":"正在加载会话总览","aria-busy":"true",children:s.jsx("div",{className:"session-dashboard-loading-cards","aria-hidden":"true",children:[0,1,2].map(e=>s.jsxs("div",{className:"session-dashboard-loading-card",children:[s.jsx("span",{className:"session-dashboard-loading-icon"}),s.jsxs("span",{className:"session-dashboard-loading-lines",children:[s.jsx("i",{}),s.jsx("i",{})]}),s.jsx("span",{className:"session-dashboard-loading-dot"})]},e))})})}function ns({incident:e,target:a,refresh:t,onOpen:r}){var l,d,o;return s.jsx(R,{text:e.message,options:((l=e.question)==null?void 0:l.options)??e.options,recommendation:e.recommendation,multiSelect:(d=e.question)==null?void 0:d.multiSelect,sourceOnly:(o=e.question)==null?void 0:o.requiresSource,onSource:()=>r(a),onAnswer:async(c,b)=>{await C({action:"answerSupervision",groupId:e.groupId,incidentId:e.id,answer:c,selectedIndices:b}),await t()}})}function D({item:e,onOpenGroup:a,onOpenSession:t,refresh:r}){var j;const[l,d]=u.useState(!1),o=u.useId(),[c,b]=u.useState(""),[f,p]=u.useState(!1),i=e.supervision,g=((i==null?void 0:i.group)??e.group).members.find(n=>{var h;return n.id===((h=((i==null?void 0:i.group)??e.group).monitoring)==null?void 0:h.supervisorId)}),m=(i==null?void 0:i.incidents.filter(n=>n.status==="waiting"))??[],x=async n=>{p(!0),b("");try{await C(n==="apply"?{action:"applySupervision",groupId:e.group.id}:{action:"pauseSupervision",groupId:e.group.id,paused:!(i!=null&&i.paused)}),await r()}catch(h){b(h instanceof Error?h.message:"操作失败")}finally{p(!1)}};return s.jsxs("article",{className:`session-dashboard-group is-${e.status}`,children:[s.jsxs("div",{className:"session-dashboard-group-summary",children:[s.jsxs("button",{className:"session-dashboard-group-open","aria-label":`进入群聊:${e.group.name}`,onClick:()=>a(e),children:[s.jsx(S,{size:20}),s.jsxs("span",{children:[s.jsx("strong",{title:e.group.name,children:e.group.name}),s.jsx("small",{title:e.group.cwd,children:e.group.cwd})]}),s.jsx("span",{className:`session-dashboard-status is-${e.status}`,children:e.decisionCount?`${e.decisionCount} 待决策`:_[e.status]})]}),s.jsx("button",{className:"session-dashboard-group-toggle","aria-label":`${l?"收起":"展开"}群聊详情:${e.group.name}`,"aria-expanded":l,"aria-controls":o,onClick:()=>d(n=>!n),children:s.jsx(E,{size:16})})]}),l&&s.jsxs("div",{id:o,className:"session-dashboard-group-details",children:[s.jsx("p",{className:"session-dashboard-progress",children:e.progress}),s.jsxs("div",{className:"session-dashboard-meta",children:[s.jsxs("span",{children:[e.runningCount," 运行中"]}),s.jsxs("span",{className:e.decisionCount?"needs-attention":"",children:[e.decisionCount," 待决策"]}),g&&s.jsxs("span",{children:[s.jsx(X,{size:13}),g.name,i!=null&&i.paused?" · 已暂停监管":" · 监工"]})]}),s.jsxs("details",{className:"session-dashboard-linked",children:[s.jsxs("summary",{children:[s.jsx("span",{children:e.sessions.length?`${e.sessions.length} 条${(j=((i==null?void 0:i.group)??e.group).monitoring)!=null&&j.targets.length?"原始":"群内"}会话`:"暂无工作会话"}),s.jsx(E,{size:15})]}),s.jsx("div",{children:e.sessions.map(n=>s.jsxs("button",{className:"session-dashboard-session",onClick:()=>t(n),children:[s.jsx(A,{agentType:n.agentType,size:17}),s.jsxs("span",{children:[s.jsx("strong",{children:n.title}),s.jsx("small",{children:N[n.agentType]})]}),s.jsx("em",{children:n.status==="running"?"运行中":n.status==="failed"?"异常":n.status==="unknown"?"待核对":"空闲"}),s.jsx(v,{size:14})]},n.id))})]}),g&&s.jsxs("details",{className:"session-dashboard-policy",children:[s.jsx("summary",{children:"监工职责"}),s.jsx("p",{children:g.role||"关注意外中断与交接断档,在原任务授权内恢复;业务选择交由你决策。"}),s.jsxs("button",{disabled:f,onClick:()=>void x("pause"),children:[i!=null&&i.paused?s.jsx(Y,{size:13}):s.jsx(H,{size:13})," ",i!=null&&i.paused?"恢复监管":"暂停监管"]})]}),e.configurationChanged&&s.jsxs("p",{className:"session-dashboard-config",children:["群配置已更新,当前监工沿用原配置。",s.jsx("button",{disabled:f,onClick:()=>void x("apply"),children:"应用最新监管配置"})]}),e.questions.map(n=>s.jsx(R,{text:n.text,options:n.options,onSource:()=>a({...e,discussionId:n.discussionId}),onAnswer:async(h,k)=>{await C(n.decisionRevision!==void 0?{action:"answerDecision",discussionId:n.discussionId,expectedRevision:n.decisionRevision,answer:h,messageId:crypto.randomUUID()}:{action:"answer",discussionId:n.discussionId,questionId:n.questionId,answer:h,selectedIndices:k}),await r()}},`${n.discussionId}:${n.questionId}`)),m.map(n=>{var k;const h=(k=i==null?void 0:i.group.monitoring)==null?void 0:k.targets.find($=>$.id===n.sessionId);return h?s.jsx(ns,{incident:n,target:h,refresh:r,onOpen:t},n.id):null}),!!(i!=null&&i.incidents.length)&&s.jsxs("details",{className:"session-dashboard-history",children:[s.jsx("summary",{children:"监工记录"}),i.incidents.slice(-6).reverse().map(n=>s.jsxs("p",{children:[s.jsx("time",{children:new Date(n.updatedAt).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"})})," ",n.message," ",s.jsx("small",{children:n.status==="queued"?"排队中":n.status==="verifying"?"核对新进度中":n.status==="resolved"?"已处理":n.status==="waiting"?"等你处理":n.status==="dismissed"?"已结束":"处理中"})]},n.id))]}),c&&s.jsx("p",{className:"collab-error",role:"alert",children:c}),s.jsxs("button",{onClick:()=>a(e),children:["进入群聊 ",s.jsx(v,{size:14})]})]})]})}function M({session:e,showAgent:a=!1,onOpen:t}){return s.jsxs("button",{className:"session-dashboard-agent-session",onClick:()=>t(e),children:[a?s.jsx("span",{className:"session-dashboard-session-brand",role:"img","aria-label":N[e.agentType],title:N[e.agentType],children:s.jsx(A,{agentType:e.agentType,size:20})}):s.jsx("span",{className:"session-dashboard-running-dot"}),s.jsxs("span",{children:[s.jsx("strong",{children:e.title}),s.jsx("small",{title:e.cwd,children:e.cwd})]}),s.jsx("span",{children:"运行中"}),s.jsx(v,{size:15})]})}function as(e){const a=e.groups.map(r=>({kind:"group",id:`group:${r.group.id}`,updated:r.updated,item:r,priority:r.decisionCount>0||r.status==="waiting"?2:+(r.runningCount>0||r.status==="running")})),t=e.agents.flatMap(r=>r.sessions).map(r=>({kind:"session",id:`session:${r.id}`,updated:r.updated,priority:1,item:r}));return[...a,...t].sort((r,l)=>l.priority-r.priority||l.updated.localeCompare(r.updated)||r.id.localeCompare(l.id))}function gs(e){const{snapshot:a,notice:t,dismissError:r,loading:l,refresh:d}=ss(),o=I(n=>n.skin),c=I(n=>n.dashboardSessionsMerged),b=I(n=>n.setDashboardSessionsMerged);u.useEffect(()=>{document.documentElement.setAttribute("data-skin",o)},[o]),u.useEffect(()=>{window.parent!==window&&window.parent.postMessage({type:G},window.location.origin)},[]);const f=e.onOpenGroup??(n=>y({kind:"group",groupId:n.group.id,title:n.group.name,discussionId:n.discussionId})),p=e.onOpenSession??(n=>y({kind:"session",session:n})),i=e.onViewGroups??(()=>y({kind:"groups"})),g=e.onNewSession??(()=>y({kind:"new-session"})),m=(a==null?void 0:a.agents.reduce((n,h)=>n+h.sessions.length,0))??0,x=a&&c?as(a):[],j=(a==null?void 0:a.decisionTotal)??(a==null?void 0:a.groups.reduce((n,h)=>n+h.decisionCount,0))??0;return s.jsxs("main",{className:"session-dashboard",children:[s.jsxs("header",{className:"session-dashboard-heading",children:[s.jsxs("div",{children:[s.jsx("span",{className:"collab-eyebrow",children:"会话总览"}),s.jsxs("h1",{children:["Dashboard ",s.jsxs("span",{className:"session-dashboard-live",children:[s.jsx("i",{}),"实时"]})]}),s.jsx("p",{children:"在一个地方查看运行、交接与需要你决定的事。"})]}),s.jsxs("div",{className:"session-dashboard-toolbar",children:[s.jsxs("button",{onClick:()=>b(!c),"aria-pressed":c,title:c?"恢复按 Agent 分组":"合并显示群聊和所有 Agent 的运行会话",children:[c?s.jsx(F,{size:16}):s.jsx(J,{size:16}),s.jsx("span",{children:c?"按 Agent 分组":"合并会话"})]}),s.jsx("button",{onClick:()=>void d(),"aria-label":"刷新会话看板",children:s.jsx(P,{size:16})}),s.jsxs("button",{onClick:i,children:[s.jsx(S,{size:16}),"群聊列表"]}),s.jsxs("button",{className:"session-dashboard-new-session",onClick:g,children:[s.jsx(U,{size:16}),"创建会话"]}),e.onClose&&s.jsx("button",{onClick:e.onClose,"aria-label":"关闭会话看板",children:s.jsx(V,{size:17})})]})]}),s.jsxs("div",{className:"session-dashboard-stats",children:[s.jsxs("span",{children:[s.jsx(T,{size:16}),s.jsx("strong",{children:m}),"运行中的原始会话"]}),s.jsxs("span",{className:j?"needs-attention":"",children:[s.jsx("strong",{children:j}),"待你决策"]}),s.jsxs("span",{children:[s.jsx("strong",{children:(a==null?void 0:a.groupTotal)??0}),"协作群"]}),s.jsx("small",{children:"无变化时监工保持安静"})]}),t&&s.jsx(K,{...t,onClose:r}),l&&!a&&s.jsx(es,{}),a&&!c&&(a.groups.length?s.jsxs("section",{"aria-label":"群聊运行总览",children:[s.jsxs("div",{className:"session-dashboard-section-title",children:[s.jsxs("h2",{children:[s.jsx(S,{size:18}),"群聊 ",s.jsx("small",{children:"Top 10 · 运行中和待决策优先"})]}),s.jsxs("button",{onClick:i,children:["查看全部 ",a.groupTotal," ",s.jsx(v,{size:14})]})]}),s.jsx("div",{className:"session-dashboard-group-grid",children:a.groups.map(n=>s.jsx(D,{item:n,onOpenGroup:f,onOpenSession:p,refresh:d},n.group.id))})]}):s.jsx("div",{className:"session-dashboard-group-create",children:s.jsxs("button",{onClick:i,children:[s.jsx(S,{size:16}),"创建群聊,配置监工"]})})),a&&(c?s.jsxs("section",{className:"session-dashboard-agent","aria-label":"合并会话",children:[s.jsx("div",{className:"session-dashboard-section-title",children:s.jsxs("h2",{children:[s.jsx(T,{size:20}),"会话 ",s.jsxs("small",{children:[m," 运行中 · ",a.groupTotal," 群聊"]})]})}),x.length?s.jsx("div",{className:"session-dashboard-agent-grid",children:x.map(n=>n.kind==="group"?s.jsx(D,{item:n.item,onOpenGroup:f,onOpenSession:p,refresh:d},n.id):s.jsx(M,{session:n.item,showAgent:!0,onOpen:p},n.id))}):s.jsx("p",{className:"session-dashboard-agent-empty",children:"当前没有运行中的会话"})]}):a.agents.map(n=>s.jsxs("section",{className:"session-dashboard-agent","aria-label":`${N[n.agentType]} 运行会话`,children:[s.jsxs("div",{className:"session-dashboard-section-title",children:[s.jsxs("h2",{children:[s.jsx(A,{agentType:n.agentType,size:20}),N[n.agentType]," ",s.jsxs("small",{children:[n.sessions.length," 运行中"]})]}),s.jsxs("button",{onClick:()=>e.onViewAgent?e.onViewAgent(n.agentType):y({kind:"agent",agentType:n.agentType}),children:["查看全部 ",s.jsx(v,{size:14})]})]}),n.sessions.length?s.jsx("div",{className:"session-dashboard-agent-grid",children:n.sessions.map(h=>s.jsx(M,{session:h,onOpen:p},h.id))}):s.jsx("p",{className:"session-dashboard-agent-empty",children:"当前没有运行中的会话"})]},n.agentType)))]})}export{ns as SupervisionIncidentDecision,gs as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as d}from"./index-
|
|
1
|
+
import{i as d}from"./index-CTJNAMck.js";const n="agentroam:session-dashboard-navigate:v1",p="agentroam:session-dashboard-ready:v1",c="agentroam:session-dashboard-chat-ready:v1",l="agentroam:session-dashboard-applied:v1",a=o=>typeof o=="string"&&/^[\w-]{1,200}$/.test(o);function I(o,r,i){var t;if(!i||o.source!==i||o.origin!==r||((t=o.data)==null?void 0:t.type)!==n)return null;const s=o.data.intent;if(!s)return null;if(s.kind==="dashboard"||s.kind==="groups"||s.kind==="new-session")return{kind:s.kind};if(s.kind==="agent"&&d(s.agentType))return{kind:"agent",agentType:s.agentType};if(s.kind==="group"&&a(s.groupId)&&typeof s.title=="string"&&s.title.length>0&&s.title.length<=100&&(s.discussionId===void 0||a(s.discussionId)))return{kind:"group",groupId:s.groupId,title:s.title,...s.discussionId?{discussionId:s.discussionId}:{}};if(s.kind==="session"&&s.session&&typeof s.session=="object"){const e=s.session;if(typeof e.id=="string"&&e.id.length>0&&e.id.length<=400&&d(e.agentType)&&typeof e.title=="string"&&e.title.length<=1e3&&typeof e.cwd=="string"&&e.cwd.length<=4e3&&(e.projectId===void 0||typeof e.projectId=="string"&&e.projectId.length<=400))return{kind:"session",session:{id:e.id,agentType:e.agentType,title:e.title,cwd:e.cwd,...e.projectId?{projectId:e.projectId}:{}}}}return null}function u(o){document.body.dataset.agentroamChatNavigation==="ready"?window.dispatchEvent(new CustomEvent(n,{detail:o})):window.parent!==window?window.parent.postMessage({type:n,intent:o},window.location.origin):o.kind==="group"?location.assign(`?view=collaboration&groupId=${encodeURIComponent(o.groupId)}${o.discussionId?`&discussionId=${encodeURIComponent(o.discussionId)}`:""}`):o.kind==="groups"?location.assign("?view=collaboration-dashboard"):o.kind==="dashboard"?location.assign("?view=session-dashboard"):o.kind==="agent"?location.assign(`?agent=${encodeURIComponent(o.agentType)}`):o.kind==="new-session"?location.assign("/app/?newSession=1"):location.assign(`?agent=${encodeURIComponent(o.session.agentType)}&session=${encodeURIComponent(o.session.id)}`)}export{l as S,c as a,p as b,n as c,u as p,I as r};
|