Stream Session Manager — 切换会话不中断流: - src/lib/stream-session-manager.ts(新建): 全局单例管理所有 SSE 流, 使用 globalThis 模式(同 conversation-registry.ts)保证 HMR 不丢状态。 管理 AbortController、idle timeout (330s)、tool timeout 自动重试、 5 分钟 GC,所有 SSE 回调写入 snapshot 并 emit 事件给订阅者。 导出 startStream / stopStream / subscribe / getSnapshot / respondToPermission / clearSnapshot 等 API。 - src/types/index.ts: 新增 ToolUseInfo、ToolResultInfo(从 ChatView 提取)、 StreamPhase、SessionStreamSnapshot、StreamEvent、StreamEventListener 类型, 作为管理器与 ChatView 之间的数据契约。 - src/components/chat/ChatView.tsx(重构): 删除 abortControllerRef 及 unmount abort effect(此前切换会话的根因)、整个 fetch/SSE 逻辑约 280 行、 accumulatedRef/toolUsesRef/toolResultsRef/beforeunload handler。 改为 subscribe() + getSnapshot() 订阅模式,unmount 仅 unsubscribe 不 abort,mount 时通过 getSnapshot 恢复进行中的流状态。 sendMessage / stopStreaming / handlePermissionResponse 全部委托管理器。 - src/hooks/usePanel.ts: PanelContextValue 新增 activeStreamingSessions: Set<string> 和 pendingApprovalSessionIds: Set<string>,支持多会话并发流指示。 - src/components/layout/AppShell.tsx: 监听 stream-session-event 窗口事件 更新 activeStreamingSessions / pendingApprovalSessionIds Set 状态; 将 beforeunload handler 从 ChatView 移至此处(全局感知所有流)。 - src/components/layout/ChatListPanel.tsx: 侧栏流指示器改用 activeStreamingSessions.has() / pendingApprovalSessionIds.has(), 支持同时显示多个会话的流/审批状态。 模型选择器始终显示 Claude Code 内置模型: - src/app/api/providers/models/route.ts: 移除 hasEnvKey 环境变量检测条件, 始终显示 "Claude Code" provider 组(Sonnet 4.6 / Opus 4.6 / Haiku 4.5)。 根因:Claude Code CLI 通过 `claude login` 存储凭证在 ~/.claude/ 下, SDK 子进程可以读取,但 Next.js 进程的 process.env 中没有对应变量, 导致之前的 hasEnvKey 检测失败时模型选择器不显示内置模型。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
84 lines
2.7 KiB
JSON
84 lines
2.7 KiB
JSON
{
|
|
"name": "codepilot",
|
|
"version": "0.17.4",
|
|
"private": true,
|
|
"author": {
|
|
"name": "op7418",
|
|
"email": "7418@openclaw.ai"
|
|
},
|
|
"description": "A native desktop GUI client for Claude Code",
|
|
"main": "dist-electron/main.js",
|
|
"scripts": {
|
|
"dev": "next dev",
|
|
"build": "next build",
|
|
"start": "next start",
|
|
"lint": "eslint",
|
|
"electron:dev": "concurrently -k \"next dev\" \"wait-on http://localhost:3000 && electron .\"",
|
|
"electron:build": "next build && node scripts/build-electron.mjs",
|
|
"electron:pack": "npm run electron:build && electron-builder --config electron-builder.yml",
|
|
"electron:pack:mac": "npm run electron:build && electron-builder --mac --config electron-builder.yml",
|
|
"electron:pack:win": "npm run electron:build && electron-builder --win --config electron-builder.yml",
|
|
"electron:pack:linux": "npm run electron:build && electron-builder --linux --config electron-builder.yml"
|
|
},
|
|
"dependencies": {
|
|
"@ai-sdk/anthropic": "^3.0.47",
|
|
"@ai-sdk/google": "^3.0.31",
|
|
"@ai-sdk/openai": "^3.0.34",
|
|
"@anthropic-ai/claude-agent-sdk": "^0.2.62",
|
|
"@google/genai": "^1.43.0",
|
|
"@hugeicons/core-free-icons": "^3.1.1",
|
|
"@hugeicons/react": "^1.1.4",
|
|
"@lobehub/icons": "^4.6.0",
|
|
"@radix-ui/react-use-controllable-state": "^1.2.2",
|
|
"@streamdown/cjk": "^1.0.1",
|
|
"@streamdown/code": "^1.0.1",
|
|
"@streamdown/math": "^1.0.1",
|
|
"@streamdown/mermaid": "^1.0.1",
|
|
"ai": "^6.0.73",
|
|
"ansi-to-react": "^6.2.6",
|
|
"better-sqlite3": "^12.6.2",
|
|
"class-variance-authority": "^0.7.1",
|
|
"clsx": "^2.1.1",
|
|
"cmdk": "^1.1.1",
|
|
"electron-updater": "^6.8.3",
|
|
"lucide-react": "^0.563.0",
|
|
"motion": "^12.33.0",
|
|
"nanoid": "^5.1.6",
|
|
"next": "16.1.6",
|
|
"next-themes": "^0.4.6",
|
|
"radix-ui": "^1.4.3",
|
|
"react": "19.2.3",
|
|
"react-dom": "19.2.3",
|
|
"react-markdown": "^10.1.0",
|
|
"react-syntax-highlighter": "^16.1.0",
|
|
"recharts": "^3.7.0",
|
|
"rehype-raw": "^7.0.0",
|
|
"remark-gfm": "^4.0.1",
|
|
"shiki": "^3.22.0",
|
|
"streamdown": "^2.1.0",
|
|
"tailwind-merge": "^3.4.0",
|
|
"use-stick-to-bottom": "^1.1.2",
|
|
"uuid": "^13.0.0"
|
|
},
|
|
"devDependencies": {
|
|
"@playwright/test": "^1.58.1",
|
|
"@tailwindcss/postcss": "^4",
|
|
"@types/better-sqlite3": "^7.6.13",
|
|
"@types/node": "^20",
|
|
"@types/react": "^19",
|
|
"@types/react-dom": "^19",
|
|
"@types/react-syntax-highlighter": "^15.5.13",
|
|
"@types/uuid": "^10.0.0",
|
|
"concurrently": "^9.2.1",
|
|
"electron": "^40.2.1",
|
|
"electron-builder": "^26.7.0",
|
|
"esbuild": "^0.27.3",
|
|
"eslint": "^9",
|
|
"eslint-config-next": "16.1.6",
|
|
"tailwindcss": "^4",
|
|
"tw-animate-css": "^1.4.0",
|
|
"typescript": "^5",
|
|
"wait-on": "^9.0.3"
|
|
}
|
|
}
|