@dyyz1993/create-agent 2.1.0 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (349) hide show
  1. package/package.json +5 -4
  2. package/src/__tests__/cli.test.ts +2 -0
  3. package/src/__tests__/copy.test.ts +110 -122
  4. package/src/__tests__/create-args.test.ts +113 -0
  5. package/src/__tests__/templates.test.ts +29 -3
  6. package/src/__tests__/update.test.ts +129 -0
  7. package/src/cli.ts +30 -32
  8. package/src/commands/create.ts +83 -24
  9. package/src/commands/update.ts +174 -0
  10. package/src/commands/workspace.ts +26 -6
  11. package/src/lib/copy.ts +233 -93
  12. package/src/lib/templates.ts +12 -0
  13. package/templates/agent/.husky/commit-msg +4 -0
  14. package/templates/agent/.husky/pre-commit +11 -0
  15. package/templates/agent/.husky/pre-push +6 -0
  16. package/templates/agent/.prettierignore +6 -0
  17. package/templates/agent/.prettierrc +9 -0
  18. package/templates/agent/CHANGELOG.md +15 -0
  19. package/templates/agent/commitlint.config.js +8 -0
  20. package/templates/agent/package.json +19 -4
  21. package/templates/agent/src/gateway/__tests__/ws-handler-token.test.ts +53 -39
  22. package/templates/agent/src/mainview/App.tsx +14 -12
  23. package/templates/agent/src/mainview/__tests__/hooks/use-rpc-init.test.ts +194 -190
  24. package/templates/agent/src/mainview/components/bash/BashPanel.tsx +210 -189
  25. package/templates/agent/src/mainview/components/chat/ChatPanel.tsx +45 -20
  26. package/templates/agent/src/mainview/components/common/ThemeToggle.tsx +41 -21
  27. package/templates/agent/src/mainview/components/debug/DebugPanel.tsx +181 -114
  28. package/templates/agent/src/mainview/components/debug/__tests__/DebugPanel.test.tsx +80 -80
  29. package/templates/agent/src/mainview/components/diff/__tests__/DiffViewerPanel.test.tsx +61 -58
  30. package/templates/agent/src/mainview/components/feed/FeedPanel.tsx +43 -41
  31. package/templates/agent/src/mainview/components/file-preview/FilePreviewOverlay.tsx +69 -50
  32. package/templates/agent/src/mainview/components/file-preview/VirtualizedCodeView.tsx +31 -18
  33. package/templates/agent/src/mainview/components/git/GitPanel.tsx +731 -490
  34. package/templates/agent/src/mainview/components/git/__tests__/GitPanel.test.tsx +157 -139
  35. package/templates/agent/src/mainview/components/layout/AppLayout.tsx +210 -161
  36. package/templates/agent/src/mainview/components/layout/__tests__/AppLayout.test.tsx +130 -122
  37. package/templates/agent/src/mainview/components/rules/RulesPanel.tsx +119 -109
  38. package/templates/agent/src/mainview/components/search/SearchPanel.tsx +123 -117
  39. package/templates/agent/src/mainview/components/search/__tests__/SearchPanel.test.tsx +64 -44
  40. package/templates/agent/src/mainview/components/sidebar/__tests__/PinButton.test.tsx +38 -38
  41. package/templates/agent/src/mainview/components/todo/TodoPanel.tsx +40 -38
  42. package/templates/agent/src/mainview/components/todo/__tests__/TodoPanel.test.tsx +72 -72
  43. package/templates/agent/src/mainview/lib/i18n/locales/en.json +175 -155
  44. package/templates/agent/src/mainview/lib/i18n/locales/zh.json +173 -155
  45. package/templates/agent/src/mainview/stores/use-app-store.ts +96 -86
  46. package/templates/agent/src/mainview/stores/use-explorer-store.ts +292 -275
  47. package/templates/agent/src/mainview/types/index.ts +23 -22
  48. package/templates/agent/src/mainview/utils/file-icon.tsx +17 -21
  49. package/templates/agent/src/shared/handlers/chat.ts +53 -53
  50. package/templates/agent/src/shared/handlers/debug.ts +13 -3
  51. package/templates/browser-agent/.env.example +19 -0
  52. package/templates/browser-agent/.husky/commit-msg +4 -0
  53. package/templates/browser-agent/.husky/pre-commit +11 -0
  54. package/templates/browser-agent/.husky/pre-push +6 -0
  55. package/templates/browser-agent/.prettierignore +6 -0
  56. package/templates/browser-agent/.prettierrc +9 -0
  57. package/templates/browser-agent/AGENTS.md +396 -0
  58. package/templates/browser-agent/CHANGELOG.md +15 -0
  59. package/templates/browser-agent/LICENSE +21 -0
  60. package/templates/browser-agent/README.md +103 -0
  61. package/templates/browser-agent/commitlint.config.js +8 -0
  62. package/templates/browser-agent/electrobun.config.ts +27 -0
  63. package/templates/browser-agent/electron/main.js +46 -0
  64. package/templates/browser-agent/electron/preload.js +5 -0
  65. package/templates/browser-agent/electron-builder.json +40 -0
  66. package/templates/browser-agent/eslint.config.mjs +79 -0
  67. package/templates/browser-agent/llms.txt +24 -0
  68. package/templates/browser-agent/package.json +140 -0
  69. package/templates/browser-agent/postcss.config.js +6 -0
  70. package/templates/browser-agent/scripts/dev.ts +138 -0
  71. package/templates/browser-agent/src/__tests__/hybrid-mode.test.ts +126 -0
  72. package/templates/browser-agent/src/__tests__/server-config-security.test.ts +55 -0
  73. package/templates/browser-agent/src/__tests__/server-config.test.ts +59 -0
  74. package/templates/browser-agent/src/bun/index.ts +130 -0
  75. package/templates/browser-agent/src/bun/three.d.ts +1 -0
  76. package/templates/browser-agent/src/gateway/http-routes.ts +1 -0
  77. package/templates/browser-agent/src/gateway/ipc-transport.ts +68 -0
  78. package/templates/browser-agent/src/gateway/sse-transport.ts +221 -0
  79. package/templates/browser-agent/src/mainview/App.tsx +45 -0
  80. package/templates/browser-agent/src/mainview/__tests__/hooks/use-rpc-init.test.ts +202 -0
  81. package/templates/browser-agent/src/mainview/__tests__/hooks/use-sidebar-resize.test.ts +127 -0
  82. package/templates/browser-agent/src/mainview/__tests__/i18n/i18n.test.ts +49 -0
  83. package/templates/browser-agent/src/mainview/__tests__/setup.ts +40 -0
  84. package/templates/browser-agent/src/mainview/__tests__/stores/use-chat-store.test.ts +73 -0
  85. package/templates/browser-agent/src/mainview/__tests__/stores/use-sidebar-store.test.ts +61 -0
  86. package/templates/browser-agent/src/mainview/__tests__/theme-variables.test.ts +36 -0
  87. package/templates/browser-agent/src/mainview/components/assets/AssetsPanel.tsx +139 -0
  88. package/templates/browser-agent/src/mainview/components/chat/ChatPanel.tsx +219 -0
  89. package/templates/browser-agent/src/mainview/components/chat/CommandBar.tsx +184 -0
  90. package/templates/browser-agent/src/mainview/components/chat/MessageBubble.tsx +249 -0
  91. package/templates/browser-agent/src/mainview/components/chat/ToolPicker.tsx +115 -0
  92. package/templates/browser-agent/src/mainview/components/common/ErrorBoundary.tsx +1 -0
  93. package/templates/browser-agent/src/mainview/components/common/LanguageSwitcher.tsx +15 -0
  94. package/templates/browser-agent/src/mainview/components/common/ThemeToggle.tsx +45 -0
  95. package/templates/browser-agent/src/mainview/components/common/__tests__/ErrorBoundary.test.tsx +74 -0
  96. package/templates/browser-agent/src/mainview/components/common/__tests__/LanguageSwitcher.test.tsx +44 -0
  97. package/templates/browser-agent/src/mainview/components/common/__tests__/ThemeToggle.test.tsx +41 -0
  98. package/templates/browser-agent/src/mainview/components/dev/NetworkPanel.tsx +155 -0
  99. package/templates/browser-agent/src/mainview/components/layout/AppLayout.tsx +311 -0
  100. package/templates/browser-agent/src/mainview/components/onboarding/SetupWizard.tsx +310 -0
  101. package/templates/browser-agent/src/mainview/components/process/ProcessPanel.tsx +329 -0
  102. package/templates/browser-agent/src/mainview/components/sidebar/SessionSidebar.tsx +122 -0
  103. package/templates/browser-agent/src/mainview/components/sidebar/SkillSidebar.tsx +115 -0
  104. package/templates/browser-agent/src/mainview/components/topbar/TopBar.tsx +350 -0
  105. package/templates/browser-agent/src/mainview/global.d.ts +13 -0
  106. package/templates/browser-agent/src/mainview/hooks/__tests__/use-breakpoint.test.ts +151 -0
  107. package/templates/browser-agent/src/mainview/hooks/use-agent-chat.ts +157 -0
  108. package/templates/browser-agent/src/mainview/hooks/use-breakpoint.ts +68 -0
  109. package/templates/browser-agent/src/mainview/hooks/use-rpc-init.ts +71 -0
  110. package/templates/browser-agent/src/mainview/hooks/use-sidebar-resize.ts +40 -0
  111. package/templates/browser-agent/src/mainview/index.css +71 -0
  112. package/templates/browser-agent/src/mainview/index.html +12 -0
  113. package/templates/browser-agent/src/mainview/lib/api-client.ts +397 -0
  114. package/templates/browser-agent/src/mainview/lib/i18n/index.ts +30 -0
  115. package/templates/browser-agent/src/mainview/lib/i18n/locales/en.json +130 -0
  116. package/templates/browser-agent/src/mainview/lib/i18n/locales/zh.json +128 -0
  117. package/templates/browser-agent/src/mainview/lib/network-bus.ts +92 -0
  118. package/templates/browser-agent/src/mainview/lib/rpc-cache.ts +94 -0
  119. package/templates/browser-agent/src/mainview/main.tsx +18 -0
  120. package/templates/browser-agent/src/mainview/stores/__tests__/use-connection-store.test.ts +26 -0
  121. package/templates/browser-agent/src/mainview/stores/__tests__/use-locale-store.test.ts +32 -0
  122. package/templates/browser-agent/src/mainview/stores/__tests__/use-log-store.test.ts +28 -0
  123. package/templates/browser-agent/src/mainview/stores/__tests__/use-theme-store.test.ts +59 -0
  124. package/templates/browser-agent/src/mainview/stores/message-batcher.ts +25 -0
  125. package/templates/browser-agent/src/mainview/stores/use-asset-store.ts +65 -0
  126. package/templates/browser-agent/src/mainview/stores/use-chat-store.ts +200 -0
  127. package/templates/browser-agent/src/mainview/stores/use-connection-store.ts +173 -0
  128. package/templates/browser-agent/src/mainview/stores/use-locale-store.ts +27 -0
  129. package/templates/browser-agent/src/mainview/stores/use-log-store.ts +16 -0
  130. package/templates/browser-agent/src/mainview/stores/use-network-panel-store.ts +18 -0
  131. package/templates/browser-agent/src/mainview/stores/use-record-store.ts +147 -0
  132. package/templates/browser-agent/src/mainview/stores/use-session-store.ts +151 -0
  133. package/templates/browser-agent/src/mainview/stores/use-sidebar-store.ts +161 -0
  134. package/templates/browser-agent/src/mainview/stores/use-theme-store.ts +46 -0
  135. package/templates/browser-agent/src/mainview/stores/use-view-store.ts +20 -0
  136. package/templates/browser-agent/src/mainview/types/index.ts +6 -0
  137. package/templates/browser-agent/src/server-config.ts +45 -0
  138. package/templates/browser-agent/src/server.ts +78 -0
  139. package/templates/browser-agent/src/shared/handlers/__tests__/chat-concurrency.test.ts +127 -0
  140. package/templates/browser-agent/src/shared/handlers/__tests__/chat-handler.test.ts +77 -0
  141. package/templates/browser-agent/src/shared/handlers/__tests__/file-handler.test.ts +100 -0
  142. package/templates/browser-agent/src/shared/handlers/__tests__/system-handler.test.ts +55 -0
  143. package/templates/browser-agent/src/shared/handlers/__tests__/timer-handler.test.ts +77 -0
  144. package/templates/browser-agent/src/shared/handlers/browser.ts +596 -0
  145. package/templates/browser-agent/src/shared/handlers/chat.ts +213 -0
  146. package/templates/browser-agent/src/shared/handlers/file.ts +99 -0
  147. package/templates/browser-agent/src/shared/handlers/index.ts +7 -0
  148. package/templates/browser-agent/src/shared/handlers/session.ts +167 -0
  149. package/templates/browser-agent/src/shared/handlers/system.ts +27 -0
  150. package/templates/browser-agent/src/shared/handlers/timer.ts +34 -0
  151. package/templates/browser-agent/src/shared/http-routes.ts +437 -0
  152. package/templates/browser-agent/src/shared/lib/__tests__/logger.test.ts +92 -0
  153. package/templates/browser-agent/src/shared/lib/__tests__/path-security.test.ts +77 -0
  154. package/templates/browser-agent/src/shared/lib/__tests__/web-server.test.ts +203 -0
  155. package/templates/browser-agent/src/shared/lib/agent.ts +384 -0
  156. package/templates/browser-agent/src/shared/lib/cdp.ts +448 -0
  157. package/templates/browser-agent/src/shared/lib/generate.ts +111 -0
  158. package/templates/browser-agent/src/shared/lib/logger.ts +152 -0
  159. package/templates/browser-agent/src/shared/lib/mock-stream.ts +147 -0
  160. package/templates/browser-agent/src/shared/lib/path-security.ts +38 -0
  161. package/templates/browser-agent/src/shared/lib/port-registry.ts +103 -0
  162. package/templates/browser-agent/src/shared/lib/web-server.ts +127 -0
  163. package/templates/browser-agent/src/shared/lib/xhs-extract.ts +71 -0
  164. package/templates/browser-agent/src/shared/modules/browser.ts +86 -0
  165. package/templates/browser-agent/src/shared/modules/chat.ts +20 -0
  166. package/templates/browser-agent/src/shared/modules/file.ts +40 -0
  167. package/templates/browser-agent/src/shared/modules/session.ts +55 -0
  168. package/templates/browser-agent/src/shared/modules/system.ts +8 -0
  169. package/templates/browser-agent/src/shared/modules/timer.ts +11 -0
  170. package/templates/browser-agent/src/shared/register-all-handlers.ts +36 -0
  171. package/templates/browser-agent/src/shared/rpc-schema.ts +34 -0
  172. package/templates/browser-agent/tailwind.config.js +15 -0
  173. package/templates/browser-agent/tsconfig.ipc.json +14 -0
  174. package/templates/browser-agent/tsconfig.json +36 -0
  175. package/templates/browser-agent/vite.config.ts +3 -0
  176. package/templates/browser-agent/vitest.config.ts +3 -0
  177. package/templates/chat/.husky/commit-msg +4 -0
  178. package/templates/chat/.husky/pre-commit +11 -0
  179. package/templates/chat/.husky/pre-push +6 -0
  180. package/templates/chat/CHANGELOG.md +15 -0
  181. package/templates/chat/commitlint.config.js +8 -0
  182. package/templates/chat/package.json +19 -4
  183. package/templates/chat/src/mainview/__tests__/hooks/use-input-history.test.ts +125 -0
  184. package/templates/chat/src/mainview/__tests__/setup.ts +32 -29
  185. package/templates/chat/src/mainview/components/chat/ChatPanel.tsx +80 -55
  186. package/templates/chat/src/mainview/components/common/ThemeToggle.tsx +40 -20
  187. package/templates/chat/src/mainview/lib/i18n/locales/en.json +175 -155
  188. package/templates/chat/src/mainview/lib/i18n/locales/zh.json +173 -155
  189. package/templates/chat/src/shared/handlers/chat.ts +17 -19
  190. package/templates/chat/src/shared/handlers/debug.ts +12 -2
  191. package/templates/cowork/.env.example +8 -0
  192. package/templates/cowork/.prettierignore +6 -0
  193. package/templates/cowork/.prettierrc +9 -0
  194. package/templates/cowork/AGENTS.md +236 -0
  195. package/templates/cowork/CHANGELOG.md +15 -0
  196. package/templates/cowork/LICENSE +21 -0
  197. package/templates/cowork/README.md +103 -0
  198. package/templates/cowork/commitlint.config.js +8 -0
  199. package/templates/cowork/docs/CODE-VIEW-PLAN.md +637 -0
  200. package/templates/cowork/docs/CODE-VIEW-V2.md +196 -0
  201. package/templates/cowork/docs/CODE-VIEW-V4.md +150 -0
  202. package/templates/cowork/electrobun.config.ts +27 -0
  203. package/templates/cowork/eslint.config.mjs +79 -0
  204. package/templates/cowork/llms.txt +24 -0
  205. package/templates/cowork/package.json +87 -0
  206. package/templates/cowork/postcss.config.js +6 -0
  207. package/templates/cowork/scripts/dev.ts +138 -0
  208. package/templates/cowork/src/__tests__/hybrid-mode.test.ts +126 -0
  209. package/templates/cowork/src/__tests__/server-config-security.test.ts +55 -0
  210. package/templates/cowork/src/__tests__/server-config.test.ts +59 -0
  211. package/templates/cowork/src/bun/index.ts +130 -0
  212. package/templates/cowork/src/bun/three.d.ts +1 -0
  213. package/templates/cowork/src/gateway/http-routes.ts +1 -0
  214. package/templates/cowork/src/gateway/ipc-transport.ts +68 -0
  215. package/templates/cowork/src/gateway/sse-transport.ts +231 -0
  216. package/templates/cowork/src/mainview/App.tsx +45 -0
  217. package/templates/cowork/src/mainview/__tests__/hooks/use-rpc-init.test.ts +202 -0
  218. package/templates/cowork/src/mainview/__tests__/hooks/use-sidebar-resize.test.ts +127 -0
  219. package/templates/cowork/src/mainview/__tests__/i18n/i18n.test.ts +49 -0
  220. package/templates/cowork/src/mainview/__tests__/setup.ts +40 -0
  221. package/templates/cowork/src/mainview/__tests__/stores/use-chat-store.test.ts +73 -0
  222. package/templates/cowork/src/mainview/__tests__/stores/use-sidebar-store.test.ts +61 -0
  223. package/templates/cowork/src/mainview/__tests__/theme-variables.test.ts +36 -0
  224. package/templates/cowork/src/mainview/components/chat/TaskChat.tsx +311 -0
  225. package/templates/cowork/src/mainview/components/chat/__tests__/localhost-links.test.ts +76 -0
  226. package/templates/cowork/src/mainview/components/common/ErrorBoundary.tsx +1 -0
  227. package/templates/cowork/src/mainview/components/common/LanguageSwitcher.tsx +15 -0
  228. package/templates/cowork/src/mainview/components/common/ThemeToggle.tsx +45 -0
  229. package/templates/cowork/src/mainview/components/common/__tests__/ErrorBoundary.test.tsx +74 -0
  230. package/templates/cowork/src/mainview/components/common/__tests__/LanguageSwitcher.test.tsx +44 -0
  231. package/templates/cowork/src/mainview/components/common/__tests__/ThemeToggle.test.tsx +41 -0
  232. package/templates/cowork/src/mainview/components/dev/NetworkPanel.tsx +155 -0
  233. package/templates/cowork/src/mainview/components/layout/AppLayout.tsx +216 -0
  234. package/templates/cowork/src/mainview/components/right/ArtifactsPanel.tsx +54 -0
  235. package/templates/cowork/src/mainview/components/right/ContextPanel.tsx +133 -0
  236. package/templates/cowork/src/mainview/components/right/ElementPicker.tsx +206 -0
  237. package/templates/cowork/src/mainview/components/right/PreviewBlock.tsx +155 -0
  238. package/templates/cowork/src/mainview/components/right/ProgressPanel.tsx +85 -0
  239. package/templates/cowork/src/mainview/components/sidebar/TaskSidebar.tsx +211 -0
  240. package/templates/cowork/src/mainview/components/topbar/TopBar.tsx +86 -0
  241. package/templates/cowork/src/mainview/global.d.ts +13 -0
  242. package/templates/cowork/src/mainview/hooks/__tests__/use-breakpoint.test.ts +123 -0
  243. package/templates/cowork/src/mainview/hooks/use-breakpoint.ts +53 -0
  244. package/templates/cowork/src/mainview/hooks/use-rpc-init.ts +26 -0
  245. package/templates/cowork/src/mainview/hooks/use-sidebar-resize.ts +40 -0
  246. package/templates/cowork/src/mainview/index.css +89 -0
  247. package/templates/cowork/src/mainview/index.html +12 -0
  248. package/templates/cowork/src/mainview/lib/api-client.ts +404 -0
  249. package/templates/cowork/src/mainview/lib/i18n/index.ts +30 -0
  250. package/templates/cowork/src/mainview/lib/i18n/locales/en.json +130 -0
  251. package/templates/cowork/src/mainview/lib/i18n/locales/zh.json +128 -0
  252. package/templates/cowork/src/mainview/lib/network-bus.ts +92 -0
  253. package/templates/cowork/src/mainview/lib/rpc-cache.ts +94 -0
  254. package/templates/cowork/src/mainview/main.tsx +18 -0
  255. package/templates/cowork/src/mainview/stores/__tests__/use-connection-store.test.ts +26 -0
  256. package/templates/cowork/src/mainview/stores/__tests__/use-locale-store.test.ts +32 -0
  257. package/templates/cowork/src/mainview/stores/__tests__/use-log-store.test.ts +28 -0
  258. package/templates/cowork/src/mainview/stores/__tests__/use-preview-store.test.ts +193 -0
  259. package/templates/cowork/src/mainview/stores/__tests__/use-sidebar-store.test.ts +81 -0
  260. package/templates/cowork/src/mainview/stores/__tests__/use-theme-store.test.ts +59 -0
  261. package/templates/cowork/src/mainview/stores/message-batcher.ts +25 -0
  262. package/templates/cowork/src/mainview/stores/use-chat-store.ts +198 -0
  263. package/templates/cowork/src/mainview/stores/use-connection-store.ts +168 -0
  264. package/templates/cowork/src/mainview/stores/use-context-store.ts +68 -0
  265. package/templates/cowork/src/mainview/stores/use-locale-store.ts +27 -0
  266. package/templates/cowork/src/mainview/stores/use-log-store.ts +16 -0
  267. package/templates/cowork/src/mainview/stores/use-network-panel-store.ts +18 -0
  268. package/templates/cowork/src/mainview/stores/use-output-store.ts +47 -0
  269. package/templates/cowork/src/mainview/stores/use-preview-store.ts +97 -0
  270. package/templates/cowork/src/mainview/stores/use-sidebar-store.ts +272 -0
  271. package/templates/cowork/src/mainview/stores/use-task-store.ts +86 -0
  272. package/templates/cowork/src/mainview/stores/use-theme-store.ts +46 -0
  273. package/templates/cowork/src/mainview/stores/use-view-store.ts +29 -0
  274. package/templates/cowork/src/mainview/types/index.ts +6 -0
  275. package/templates/cowork/src/server-config.ts +44 -0
  276. package/templates/cowork/src/server.ts +78 -0
  277. package/templates/cowork/src/shared/handlers/__tests__/chat-concurrency.test.ts +127 -0
  278. package/templates/cowork/src/shared/handlers/__tests__/chat-handler.test.ts +77 -0
  279. package/templates/cowork/src/shared/handlers/__tests__/file-handler.test.ts +100 -0
  280. package/templates/cowork/src/shared/handlers/__tests__/preview-handler.test.ts +172 -0
  281. package/templates/cowork/src/shared/handlers/__tests__/system-handler.test.ts +55 -0
  282. package/templates/cowork/src/shared/handlers/__tests__/timer-handler.test.ts +77 -0
  283. package/templates/cowork/src/shared/handlers/chat.ts +213 -0
  284. package/templates/cowork/src/shared/handlers/context.ts +72 -0
  285. package/templates/cowork/src/shared/handlers/file.ts +99 -0
  286. package/templates/cowork/src/shared/handlers/index.ts +9 -0
  287. package/templates/cowork/src/shared/handlers/output.ts +59 -0
  288. package/templates/cowork/src/shared/handlers/preview.ts +81 -0
  289. package/templates/cowork/src/shared/handlers/system.ts +27 -0
  290. package/templates/cowork/src/shared/handlers/task.ts +101 -0
  291. package/templates/cowork/src/shared/handlers/timer.ts +34 -0
  292. package/templates/cowork/src/shared/http-routes.ts +444 -0
  293. package/templates/cowork/src/shared/lib/__tests__/logger.test.ts +92 -0
  294. package/templates/cowork/src/shared/lib/__tests__/path-security.test.ts +77 -0
  295. package/templates/cowork/src/shared/lib/__tests__/web-server.test.ts +203 -0
  296. package/templates/cowork/src/shared/lib/logger.ts +152 -0
  297. package/templates/cowork/src/shared/lib/path-security.ts +38 -0
  298. package/templates/cowork/src/shared/lib/port-registry.ts +103 -0
  299. package/templates/cowork/src/shared/lib/web-server.ts +127 -0
  300. package/templates/cowork/src/shared/modules/chat.ts +20 -0
  301. package/templates/cowork/src/shared/modules/context.ts +32 -0
  302. package/templates/cowork/src/shared/modules/file.ts +40 -0
  303. package/templates/cowork/src/shared/modules/output.ts +20 -0
  304. package/templates/cowork/src/shared/modules/preview.ts +44 -0
  305. package/templates/cowork/src/shared/modules/system.ts +8 -0
  306. package/templates/cowork/src/shared/modules/task.ts +31 -0
  307. package/templates/cowork/src/shared/modules/timer.ts +11 -0
  308. package/templates/cowork/src/shared/register-all-handlers.ts +36 -0
  309. package/templates/cowork/src/shared/rpc-schema.ts +38 -0
  310. package/templates/cowork/tailwind.config.js +15 -0
  311. package/templates/cowork/test-upload.txt +0 -0
  312. package/templates/cowork/tsconfig.ipc.json +14 -0
  313. package/templates/cowork/tsconfig.json +36 -0
  314. package/templates/cowork/vite.config.ts +3 -0
  315. package/templates/cowork/vitest.config.ts +3 -0
  316. package/templates/general/.husky/commit-msg +4 -0
  317. package/templates/general/.husky/pre-commit +11 -0
  318. package/templates/general/.husky/pre-push +6 -0
  319. package/templates/general/CHANGELOG.md +15 -0
  320. package/templates/general/commitlint.config.js +8 -0
  321. package/templates/general/package.json +19 -4
  322. package/templates/general/src/mainview/__tests__/hooks/use-input-history.test.ts +125 -0
  323. package/templates/general/src/mainview/__tests__/setup.ts +32 -29
  324. package/templates/general/src/mainview/components/chat/ChatPanel.tsx +80 -55
  325. package/templates/general/src/mainview/components/common/ThemeToggle.tsx +40 -20
  326. package/templates/general/src/mainview/components/debug/DebugPanel.tsx +170 -156
  327. package/templates/general/src/mainview/components/debug/__tests__/DebugPanel.test.tsx +169 -0
  328. package/templates/general/src/mainview/components/explorer/ConfirmDialog.tsx +42 -42
  329. package/templates/general/src/mainview/components/explorer/ContextMenu.tsx +72 -67
  330. package/templates/general/src/mainview/components/feed/FeedPanel.tsx +7 -5
  331. package/templates/general/src/mainview/components/file-preview/FilePreviewOverlay.tsx +64 -45
  332. package/templates/general/src/mainview/components/file-preview/VirtualizedCodeView.tsx +24 -7
  333. package/templates/general/src/mainview/components/git/GitPanel.tsx +700 -473
  334. package/templates/general/src/mainview/components/layout/AppLayout.tsx +123 -114
  335. package/templates/general/src/mainview/components/search/SearchPanel.tsx +15 -19
  336. package/templates/general/src/mainview/lib/i18n/locales/en.json +175 -155
  337. package/templates/general/src/mainview/lib/i18n/locales/zh.json +173 -155
  338. package/templates/general/src/mainview/stores/__tests__/use-explorer-store.test.ts +259 -0
  339. package/templates/general/src/mainview/stores/__tests__/use-feed-store.test.ts +160 -0
  340. package/templates/general/src/mainview/stores/__tests__/use-git-store.test.ts +313 -0
  341. package/templates/general/src/mainview/stores/__tests__/use-notification-store.test.ts +115 -0
  342. package/templates/general/src/mainview/stores/__tests__/use-sidebar-store.test.ts +120 -0
  343. package/templates/general/src/mainview/stores/use-explorer-store.ts +277 -260
  344. package/templates/general/src/mainview/types/index.ts +21 -20
  345. package/templates/general/src/shared/handlers/chat.ts +1 -1
  346. package/templates/general/src/shared/handlers/debug.ts +12 -2
  347. package/templates/shared/components/ErrorBoundary.tsx +0 -1
  348. package/templates/shared/vite-base.config.ts +8 -7
  349. /package/templates/{shared → browser-agent}/test-upload.txt +0 -0
@@ -0,0 +1,404 @@
1
+ import { createTypedClient, IPCTransport } from '@dyyz1993/rpc-core';
2
+ import type {
3
+ TypedClient,
4
+ MethodParams,
5
+ MethodResult,
6
+ EventPayload,
7
+ EventMetadata,
8
+ Transport,
9
+ } from '@dyyz1993/rpc-core';
10
+ import type { RPCMethods, RPCEvents } from '../../shared/rpc-schema';
11
+ import { rpcCache, CACHEABLE_METHODS } from './rpc-cache';
12
+ import { networkBus } from './network-bus';
13
+
14
+ /**
15
+ * Token 来源优先级:
16
+ * 1. Vite 环境变量 VITE_AUTH_TOKEN(从 .env 注入)
17
+ * 2. URL query ?token=xxx(部署时注入)
18
+ * 3. localStorage "rpc-auth-token"
19
+ * 4. 默认值(开发备用)
20
+ */
21
+ function resolveAuthToken(): string {
22
+ if (typeof window !== 'undefined') {
23
+ // Vite 注入的环境变量(来自 .env 的 VITE_AUTH_TOKEN)
24
+ const viteToken =
25
+ typeof import.meta !== 'undefined' &&
26
+ (import.meta as Record<string, unknown>).env?.VITE_AUTH_TOKEN;
27
+ if (viteToken) return viteToken;
28
+
29
+ const fromQuery = new URLSearchParams(window.location.search).get('token');
30
+ if (fromQuery) return fromQuery;
31
+ const fromStorage = localStorage.getItem('rpc-auth-token');
32
+ if (fromStorage) return fromStorage;
33
+ }
34
+ return 'pi-agent-template-token';
35
+ }
36
+
37
+ const AUTH_TOKEN = resolveAuthToken();
38
+
39
+ /**
40
+ * Browser SSE Transport — bridges EventSource (server→client) and
41
+ * fetch POST (client→server) into the rpc-core Transport interface.
42
+ *
43
+ * - send(): POST /api/rpc with the message JSON; response arrives via SSE.
44
+ * - onMessage: EventSource "data:" frames parsed and forwarded to handlers.
45
+ *
46
+ * The SSE stream delivers the clientId in a "ready" event; subsequent POSTs
47
+ * carry ?clientId= so the backend routes into the correct per-client RPCServer.
48
+ */
49
+ class BrowserSseTransport implements Transport {
50
+ private messageHandlers = new Set<(msg: unknown) => void>();
51
+ private errorHandlers = new Set<(err: Error) => void>();
52
+ private disconnectHandlers = new Set<() => void>();
53
+ private eventSource: EventSource | null = null;
54
+ clientId: string | null = null;
55
+ private baseUrl = '';
56
+ private connected = false;
57
+ private closed = false;
58
+
59
+ constructor(baseUrl: string, token: string) {
60
+ this.baseUrl = baseUrl;
61
+ this.connect(token);
62
+ }
63
+
64
+ private connect(token: string): void {
65
+ const url = `${this.baseUrl}/api/events?token=${encodeURIComponent(token)}`;
66
+ const es = new EventSource(url);
67
+ this.eventSource = es;
68
+
69
+ // "ready" event carries the clientId — fires on every (re)connect.
70
+ // Must update clientId each time because reconnect assigns a new one.
71
+ es.addEventListener('ready', (ev: MessageEvent) => {
72
+ try {
73
+ const data = JSON.parse(ev.data);
74
+ this.clientId = data.clientId;
75
+ this.connected = true;
76
+ } catch {
77
+ /* ignore */
78
+ }
79
+ });
80
+
81
+ // Default message channel: "data:" frames carry RPC responses/events
82
+ es.onmessage = (ev: MessageEvent) => {
83
+ try {
84
+ const msg = JSON.parse(ev.data);
85
+ // Debug: log SSE messages to console for troubleshooting
86
+ if (msg.type === 'event') {
87
+ console.warn(`[SSE] event: ${msg.eventType}`, msg.payload);
88
+ } else if (msg.type === 'response') {
89
+ console.warn(`[SSE] response: ${msg.id}`, msg.result || msg.error);
90
+ }
91
+ for (const handler of [...this.messageHandlers]) {
92
+ handler(msg);
93
+ }
94
+ } catch {
95
+ /* ignore parse errors */
96
+ }
97
+ };
98
+
99
+ es.onopen = () => {
100
+ this.connected = true;
101
+ };
102
+
103
+ es.onerror = () => {
104
+ if (this.closed) return;
105
+ this.connected = false;
106
+ for (const handler of [...this.errorHandlers]) {
107
+ handler(new Error('SSE connection error'));
108
+ }
109
+ for (const handler of [...this.disconnectHandlers]) {
110
+ handler();
111
+ }
112
+ // EventSource auto-reconnects natively; clientId will refresh on "ready"
113
+ };
114
+ }
115
+
116
+ async send(message: unknown): Promise<void> {
117
+ if (this.closed) throw new Error('SSE transport closed');
118
+
119
+ // Wait for clientId (with timeout to avoid hanging forever)
120
+ if (!this.clientId) {
121
+ await this.waitForClientId();
122
+ }
123
+
124
+ const url = `${this.baseUrl}/api/rpc?token=${encodeURIComponent(AUTH_TOKEN)}&clientId=${encodeURIComponent(this.clientId!)}`;
125
+ const res = await fetch(url, {
126
+ method: 'POST',
127
+ headers: { 'Content-Type': 'application/json' },
128
+ body: JSON.stringify(message),
129
+ });
130
+
131
+ // 404 = clientId stale (SSE reconnected with a new ID). Retry once.
132
+ if (res.status === 404) {
133
+ // Force wait for fresh clientId
134
+ this.clientId = null;
135
+ this.connected = false;
136
+ await this.waitForClientId();
137
+ // Retry the POST with the fresh clientId
138
+ const retryUrl = `${this.baseUrl}/api/rpc?token=${encodeURIComponent(AUTH_TOKEN)}&clientId=${encodeURIComponent(this.clientId!)}`;
139
+ const retryRes = await fetch(retryUrl, {
140
+ method: 'POST',
141
+ headers: { 'Content-Type': 'application/json' },
142
+ body: JSON.stringify(message),
143
+ });
144
+ if (!retryRes.ok) {
145
+ throw new Error(`RPC POST failed after retry: ${retryRes.status}`);
146
+ }
147
+ return;
148
+ }
149
+
150
+ if (!res.ok) {
151
+ throw new Error(`RPC POST failed: ${res.status}`);
152
+ }
153
+ }
154
+
155
+ private waitForClientId(timeoutMs = 10000): Promise<void> {
156
+ if (this.clientId) return Promise.resolve();
157
+ return new Promise((resolve, reject) => {
158
+ const start = Date.now();
159
+ const check = setInterval(() => {
160
+ if (this.clientId) {
161
+ clearInterval(check);
162
+ resolve();
163
+ } else if (Date.now() - start > timeoutMs) {
164
+ clearInterval(check);
165
+ reject(new Error('SSE 连接超时:未收到 clientId'));
166
+ }
167
+ }, 50);
168
+ });
169
+ }
170
+
171
+ /** 等待 SSE ready 事件(clientId + connected),供 initialize() 使用 */
172
+ async waitForReady(timeoutMs = 10000): Promise<void> {
173
+ await this.waitForClientId(timeoutMs);
174
+ }
175
+
176
+ onMessage(handler: (msg: unknown) => void): () => void {
177
+ this.messageHandlers.add(handler);
178
+ return () => {
179
+ this.messageHandlers.delete(handler);
180
+ };
181
+ }
182
+
183
+ onError(handler: (err: Error) => void): () => void {
184
+ this.errorHandlers.add(handler);
185
+ return () => {
186
+ this.errorHandlers.delete(handler);
187
+ };
188
+ }
189
+
190
+ onDisconnect(handler: () => void): () => void {
191
+ this.disconnectHandlers.add(handler);
192
+ return () => {
193
+ this.disconnectHandlers.delete(handler);
194
+ };
195
+ }
196
+
197
+ isConnected(): boolean {
198
+ return this.connected;
199
+ }
200
+
201
+ close(): void {
202
+ this.closed = true;
203
+ this.connected = false;
204
+ if (this.eventSource) {
205
+ this.eventSource.close();
206
+ this.eventSource = null;
207
+ }
208
+ this.messageHandlers.clear();
209
+ this.errorHandlers.clear();
210
+ this.disconnectHandlers.clear();
211
+ }
212
+ }
213
+
214
+ class APIClientImpl {
215
+ private client: TypedClient<RPCMethods, RPCEvents> | null = null;
216
+ private initPromise: Promise<void> | null = null;
217
+ private _transport: 'ipc' | 'sse' = 'sse';
218
+ private _baseUrl: string | null = null;
219
+ private sseTransport: BrowserSseTransport | null = null;
220
+
221
+ /**
222
+ * 桌面端同步初始化:通过 executeJavascript 接收 + __electrobunBunBridge 发送
223
+ */
224
+ initSyncForDesktop(): void {
225
+ if (this.client) return;
226
+
227
+ const ipcTransport = new IPCTransport();
228
+ this._transport = 'ipc';
229
+ this._baseUrl = null;
230
+ this.client = createTypedClient<RPCMethods, RPCEvents>(ipcTransport);
231
+ this.setupElectrobunBridge(ipcTransport);
232
+ }
233
+
234
+ /**
235
+ * 异步初始化:Web 端使用(连接 SSE + HTTP)
236
+ */
237
+ async initialize(): Promise<void> {
238
+ // 已连接且 transport 正常 → 直接返回
239
+ if (this.client && (this._transport === 'ipc' || this.sseTransport?.isConnected())) {
240
+ return;
241
+ }
242
+
243
+ // client 存在但 SSE 断开了 → 清理后重连
244
+ if (this.client && this.sseTransport && !this.sseTransport.isConnected()) {
245
+ this.sseTransport.close();
246
+ this.sseTransport = null;
247
+ this.client = null;
248
+ this.initPromise = null;
249
+ }
250
+
251
+ if (this.initPromise) return this.initPromise;
252
+
253
+ this.initPromise = (async () => {
254
+ const env = this.detectEnvironment();
255
+
256
+ if (env === 'electrobun') {
257
+ // 不应走到这里,桌面端应通过 initSyncForDesktop() 初始化
258
+ this.initSyncForDesktop();
259
+ } else {
260
+ try {
261
+ this._transport = 'sse';
262
+ const baseUrl = this.resolveBaseUrl();
263
+ this.sseTransport = new BrowserSseTransport(baseUrl, AUTH_TOKEN);
264
+ this.client = createTypedClient<RPCMethods, RPCEvents>(this.sseTransport);
265
+ this._baseUrl = baseUrl;
266
+
267
+ // 等待 SSE ready(clientId 到达)才认为初始化完成
268
+ await this.sseTransport.waitForReady();
269
+ } catch (err) {
270
+ // 初始化失败 → 清理缓存,允许重试
271
+ this.sseTransport?.close();
272
+ this.sseTransport = null;
273
+ this.client = null;
274
+ this.initPromise = null;
275
+ throw err;
276
+ }
277
+ }
278
+ })();
279
+
280
+ return this.initPromise;
281
+ }
282
+
283
+ private detectEnvironment(): 'electrobun' | 'browser' {
284
+ if (typeof window === 'undefined') return 'browser';
285
+ if ((window as Record<string, unknown>).__electrobunBunBridge) return 'electrobun';
286
+ return 'browser';
287
+ }
288
+
289
+ private resolveBaseUrl(): string {
290
+ if (typeof window === 'undefined') return `http://localhost:${process.env.PORT || '5300'}`;
291
+ // In dev, Vite proxies /api → backend, so relative path works.
292
+ // For standalone deployment, use window.location.origin.
293
+ return window.location.origin;
294
+ }
295
+
296
+ /**
297
+ * 桌面端 IPC 桥接:
298
+ * - Bun → Browser: 通过 executeJavascript 调用 window.__piAgentIPC()
299
+ * - Browser → Bun: 通过 __electrobunBunBridge.postMessage 发送 Electrobun 消息格式
300
+ */
301
+ private setupElectrobunBridge(ipcTransport: IPCTransport): void {
302
+ if (typeof window === 'undefined') return;
303
+
304
+ const win = window as Record<string, unknown>;
305
+
306
+ // 1. 注册接收函数:Bun 通过 executeJavascript 调用此函数发送消息到 Browser
307
+ win.__piAgentIPC = (msg: unknown) => {
308
+ ipcTransport.simulateMessage(msg);
309
+ };
310
+
311
+ // 2. 覆写 send:将 RPC-core 消息包装成 Electrobun 消息格式,通过原生桥接发送
312
+ const bridge = win.__electrobunBunBridge;
313
+
314
+ if (bridge) {
315
+ ipcTransport.send = async (message: unknown) => {
316
+ // 包装成 Electrobun message packet,bun 端 defineRPC 注册了 "rpc-message" handler
317
+ const electrobunPacket = {
318
+ type: 'message',
319
+ id: 'rpc-message',
320
+ payload: JSON.stringify(message),
321
+ };
322
+ bridge.postMessage(JSON.stringify(electrobunPacket));
323
+ };
324
+ }
325
+ }
326
+
327
+ getTransport(): 'ipc' | 'sse' {
328
+ return this._transport;
329
+ }
330
+
331
+ /** Web 端 HTTP 基础 URL(如 http://localhost:5200),桌面端返回 null */
332
+ getBaseUrl(): string | null {
333
+ return this._baseUrl;
334
+ }
335
+
336
+ /** 获取当前 auth token(用于需要直接调 HTTP 的场景) */
337
+ getAuthToken(): string {
338
+ return AUTH_TOKEN;
339
+ }
340
+
341
+ async call<K extends keyof RPCMethods>(
342
+ method: K,
343
+ params: MethodParams<RPCMethods, K>,
344
+ ): Promise<MethodResult<RPCMethods, K>> {
345
+ const methodStr = method as string;
346
+ const ttl = CACHEABLE_METHODS[methodStr];
347
+ if (ttl !== undefined) {
348
+ const cached = rpcCache.get<MethodResult<RPCMethods, K>>(methodStr, params, ttl);
349
+ if (cached !== null) return cached;
350
+ }
351
+
352
+ await this.initialize();
353
+ const t0 = performance.now();
354
+ networkBus.emitRequest(methodStr, params);
355
+ const result = await this.client!.call(method, params);
356
+ const elapsed = Math.round(performance.now() - t0);
357
+ networkBus.emitResponse(methodStr, elapsed);
358
+
359
+ if (ttl !== undefined) {
360
+ rpcCache.set(methodStr, params, result);
361
+ }
362
+
363
+ return result;
364
+ }
365
+
366
+ async subscribe<K extends keyof RPCEvents>(
367
+ eventType: K,
368
+ handler: (payload: EventPayload<RPCEvents[K]>, metadata: EventMetadata<RPCEvents[K]>) => void,
369
+ filter?: Record<string, unknown>,
370
+ ): Promise<string> {
371
+ await this.initialize();
372
+
373
+ // Wrap handler to capture SSE events for the network panel
374
+ const wrapped = (
375
+ payload: EventPayload<RPCEvents[K]>,
376
+ metadata: EventMetadata<RPCEvents[K]>,
377
+ ) => {
378
+ networkBus.emitEvent(
379
+ eventType as string,
380
+ metadata as unknown as Record<string, unknown> | undefined,
381
+ );
382
+ handler(payload, metadata);
383
+ };
384
+
385
+ const subId = this.client!.subscribe(eventType, wrapped, filter);
386
+ return subId;
387
+ }
388
+
389
+ unsubscribe(subscriptionId: string): void {
390
+ this.client?.unsubscribe(subscriptionId);
391
+ }
392
+
393
+ isConnected(): boolean {
394
+ return this.client !== null;
395
+ }
396
+
397
+ close(): void {
398
+ this.client?.close();
399
+ }
400
+ }
401
+
402
+ export const apiClient = new APIClientImpl();
403
+ export type { APIClientImpl, RPCMethods, RPCEvents };
404
+ export type { Transport };
@@ -0,0 +1,30 @@
1
+ import i18n from "i18next";
2
+ import { initReactI18next } from "react-i18next";
3
+ import LanguageDetector from "i18next-browser-languagedetector";
4
+ import en from "./locales/en.json";
5
+ import zh from "./locales/zh.json";
6
+
7
+ export const supportedLocales = ["en", "zh"] as const;
8
+ export type Locale = (typeof supportedLocales)[number];
9
+
10
+ i18n
11
+ .use(LanguageDetector)
12
+ .use(initReactI18next)
13
+ .init({
14
+ resources: {
15
+ en: { translation: en },
16
+ zh: { translation: zh },
17
+ },
18
+ fallbackLng: "en",
19
+ supportedLngs: [...supportedLocales],
20
+ interpolation: {
21
+ escapeValue: false,
22
+ },
23
+ detection: {
24
+ order: ["localStorage", "navigator"],
25
+ lookupLocalStorage: "locale",
26
+ caches: ["localStorage"],
27
+ },
28
+ });
29
+
30
+ export default i18n;
@@ -0,0 +1,130 @@
1
+ {
2
+ "app": {
3
+ "title": "Browser Agent",
4
+ "connecting": "Connecting to RPC server...",
5
+ "online": "Online",
6
+ "offline": "Offline",
7
+ "mode": {
8
+ "desktop": "Desktop (IPC)",
9
+ "web": "Web (WebSocket)"
10
+ }
11
+ },
12
+ "sidebar": {
13
+ "explorer": "Explorer",
14
+ "git": "Source Control",
15
+ "search": "Search"
16
+ },
17
+ "tabs": {
18
+ "chat": "Chat",
19
+ "debug": "Debug"
20
+ },
21
+ "chat": {
22
+ "title": "Agent Chat",
23
+ "placeholder": "Type your request...",
24
+ "send": "Send",
25
+ "empty": "Start a conversation...",
26
+ "welcome": "Start your first collection"
27
+ },
28
+ "session": {
29
+ "new": "New Session",
30
+ "history": "History"
31
+ },
32
+ "skills": {
33
+ "title": "Skills",
34
+ "xhsExplore": "Xiaohongshu Explore",
35
+ "xhsSearch": "Keyword Search",
36
+ "xhsBlogger": "Blogger Profile"
37
+ },
38
+ "explorer": {
39
+ "title": "Explorer",
40
+ "pathPlaceholder": "Path",
41
+ "refresh": "Refresh",
42
+ "listDirectory": "List directory",
43
+ "newFile": "New File",
44
+ "newFolder": "New Folder",
45
+ "rename": "Rename",
46
+ "delete": "Delete",
47
+ "copyPath": "Copy Path",
48
+ "confirmDelete": "Confirm Delete",
49
+ "confirmDeleteMessage": "Are you sure you want to delete \"{{name}}\"? This action cannot be undone.",
50
+ "emptyHint": "Enter path and click refresh"
51
+ },
52
+ "git": {
53
+ "title": "Source Control",
54
+ "staged": "Staged Changes",
55
+ "changes": "Changes",
56
+ "untracked": "Untracked",
57
+ "noChanges": "No changes detected",
58
+ "commits": "Commits",
59
+ "noCommits": "No commits",
60
+ "noFiles": "No files",
61
+ "loadingFiles": "Loading files...",
62
+ "commitPlaceholder": "Commit message (Ctrl+Enter to commit)",
63
+ "committing": "Committing...",
64
+ "commit": "Commit",
65
+ "openDiff": "Open Diff",
66
+ "openFile": "Open File",
67
+ "copyHash": "Copy Hash",
68
+ "copyMessage": "Copy Message",
69
+ "copyPath": "Copy Path",
70
+ "pull": "Pull",
71
+ "push": "Push",
72
+ "refresh": "Refresh",
73
+ "stage": "Stage",
74
+ "unstage": "Unstage",
75
+ "stageAll": "Stage all",
76
+ "unstageAll": "Unstage all",
77
+ "worktrees": "Worktrees",
78
+ "close": "Close",
79
+ "justNow": "just now",
80
+ "minutesAgo": "{{count}}m ago",
81
+ "hoursAgo": "{{count}}h ago",
82
+ "daysAgo": "{{count}}d ago"
83
+ },
84
+ "debug": {
85
+ "rpcCalls": "RPC Calls",
86
+ "call": "Call",
87
+ "subscriptions": "Subscriptions",
88
+ "subscribe": "Subscribe",
89
+ "unsubscribe": "Unsubscribe",
90
+ "events": "{{count}} events",
91
+ "noEvents": "No events yet",
92
+ "logs": "Logs",
93
+ "clear": "Clear",
94
+ "clearAll": "Clear all debug data",
95
+ "expandPanel": "Expand Debug Panel",
96
+ "collapsePanel": "Collapse Debug Panel"
97
+ },
98
+ "search": {
99
+ "noResults": "No results found",
100
+ "noResultsFor": "No results for \"{{query}}\"",
101
+ "resultsIn": "{{count}} result in {{fileCount}} file",
102
+ "resultsIn_plural": "{{count}} results in {{fileCount}} files",
103
+ "filesSearched": "({{count}} file searched)",
104
+ "filesSearched_plural": "({{count}} files searched)",
105
+ "typeToSearch": "Type a search term and press Enter",
106
+ "focusShortcut": "...{{key}}+F to focus search",
107
+ "tryDifferent": "Try different search terms"
108
+ },
109
+ "error": {
110
+ "title": "Something went wrong",
111
+ "unexpected": "An unexpected error occurred",
112
+ "retry": "Retry"
113
+ },
114
+ "theme": {
115
+ "light": "Light",
116
+ "dark": "Dark",
117
+ "toggle": "Toggle theme"
118
+ },
119
+ "locale": {
120
+ "en": "English",
121
+ "zh": "中文"
122
+ },
123
+ "common": {
124
+ "loading": "Loading...",
125
+ "cancel": "Cancel",
126
+ "confirm": "Confirm",
127
+ "save": "Save",
128
+ "delete": "Delete"
129
+ }
130
+ }
@@ -0,0 +1,128 @@
1
+ {
2
+ "app": {
3
+ "title": "Browser Agent",
4
+ "connecting": "正在连接 RPC 服务器...",
5
+ "online": "在线",
6
+ "offline": "离线",
7
+ "mode": {
8
+ "desktop": "桌面 (IPC)",
9
+ "web": "Web (WebSocket)"
10
+ }
11
+ },
12
+ "sidebar": {
13
+ "explorer": "资源管理器",
14
+ "git": "源代码管理",
15
+ "search": "搜索"
16
+ },
17
+ "tabs": {
18
+ "chat": "聊天",
19
+ "debug": "调试"
20
+ },
21
+ "chat": {
22
+ "title": "Agent 对话",
23
+ "placeholder": "输入需求...",
24
+ "send": "发送",
25
+ "empty": "开始对话...",
26
+ "welcome": "开始你的第一次采集"
27
+ },
28
+ "session": {
29
+ "new": "新建会话",
30
+ "history": "历史会话"
31
+ },
32
+ "skills": {
33
+ "title": "技能库",
34
+ "xhsExplore": "小红书首页采集",
35
+ "xhsSearch": "关键词搜索采集",
36
+ "xhsBlogger": "博主主页采集"
37
+ },
38
+ "explorer": {
39
+ "title": "资源管理器",
40
+ "pathPlaceholder": "路径",
41
+ "refresh": "刷新",
42
+ "listDirectory": "列出目录",
43
+ "newFile": "新建文件",
44
+ "newFolder": "新建文件夹",
45
+ "rename": "重命名",
46
+ "delete": "删除",
47
+ "copyPath": "复制路径",
48
+ "confirmDelete": "确认删除",
49
+ "confirmDeleteMessage": "确定要删除 \"{{name}}\" 吗?此操作无法撤销。",
50
+ "emptyHint": "输入路径并点击刷新"
51
+ },
52
+ "git": {
53
+ "title": "源代码管理",
54
+ "staged": "已暂存更改",
55
+ "changes": "更改",
56
+ "untracked": "未跟踪",
57
+ "noChanges": "未检测到更改",
58
+ "commits": "提交记录",
59
+ "noCommits": "暂无提交",
60
+ "noFiles": "暂无文件",
61
+ "loadingFiles": "加载文件中...",
62
+ "commitPlaceholder": "提交信息 (Ctrl+Enter 提交)",
63
+ "committing": "提交中...",
64
+ "commit": "提交",
65
+ "openDiff": "打开差异",
66
+ "openFile": "打开文件",
67
+ "copyHash": "复制哈希",
68
+ "copyMessage": "复制信息",
69
+ "copyPath": "复制路径",
70
+ "pull": "拉取",
71
+ "push": "推送",
72
+ "refresh": "刷新",
73
+ "stage": "暂存",
74
+ "unstage": "取消暂存",
75
+ "stageAll": "全部暂存",
76
+ "unstageAll": "全部取消暂存",
77
+ "worktrees": "工作树",
78
+ "close": "关闭",
79
+ "justNow": "刚刚",
80
+ "minutesAgo": "{{count}}分钟前",
81
+ "hoursAgo": "{{count}}小时前",
82
+ "daysAgo": "{{count}}天前"
83
+ },
84
+ "debug": {
85
+ "rpcCalls": "RPC 调用",
86
+ "call": "调用",
87
+ "subscriptions": "订阅",
88
+ "subscribe": "订阅",
89
+ "unsubscribe": "取消订阅",
90
+ "events": "{{count}} 个事件",
91
+ "noEvents": "暂无事件",
92
+ "logs": "日志",
93
+ "clear": "清空",
94
+ "clearAll": "清空所有调试数据",
95
+ "expandPanel": "展开调试面板",
96
+ "collapsePanel": "折叠调试面板"
97
+ },
98
+ "search": {
99
+ "noResults": "未找到结果",
100
+ "noResultsFor": "未找到 \"{{query}}\" 的结果",
101
+ "resultsIn": "{{count}} 个结果在 {{fileCount}} 个文件中",
102
+ "filesSearched": "(已搜索 {{count}} 个文件)",
103
+ "typeToSearch": "输入搜索词并按回车",
104
+ "focusShortcut": "...{{key}}+F 聚焦搜索",
105
+ "tryDifferent": "尝试不同的搜索词"
106
+ },
107
+ "error": {
108
+ "title": "出了点问题",
109
+ "unexpected": "发生了意外错误",
110
+ "retry": "重试"
111
+ },
112
+ "theme": {
113
+ "light": "浅色",
114
+ "dark": "深色",
115
+ "toggle": "切换主题"
116
+ },
117
+ "locale": {
118
+ "en": "English",
119
+ "zh": "中文"
120
+ },
121
+ "common": {
122
+ "loading": "加载中...",
123
+ "cancel": "取消",
124
+ "confirm": "确认",
125
+ "save": "保存",
126
+ "delete": "删除"
127
+ }
128
+ }