@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,196 @@
1
+ # Cowork Code View V2 — 右侧边栏浏览器预览 + 元素选择器
2
+
3
+ > **核心改动**:浏览器预览从"Code Tab 全文 iframe"改为"右侧面板独立区块"。
4
+ > Code Tab 只负责地址栏和 URL 管理,实际渲染交给右栏。
5
+ > 新增元素选择器功能,支持选取页面元素并提取 CSS selector。
6
+
7
+ ---
8
+
9
+ ## 一、布局变化
10
+
11
+ ### 当前(V1)
12
+
13
+ ```
14
+ Code Tab → 中间区域 = [地址栏 + iframe 全屏]
15
+ 右栏 = 隐藏(Cowork 模式才显示)
16
+ ```
17
+
18
+ ### 目标(V2)
19
+
20
+ ```
21
+ Code Tab → 左栏 = URL 历史
22
+ 中栏 = [地址栏 + URL 管理界面](不渲染 iframe)
23
+ 右栏 = Progress + Artifacts + Context + 🆕 Preview 浏览器
24
+ ```
25
+
26
+ ---
27
+
28
+ ## 二、改动清单
29
+
30
+ ### 2.1 CodeView.tsx — 去掉 iframe,只留地址栏 + 管理界面
31
+
32
+ ```typescript
33
+ // 当前:CodeView = AddressBar + PreviewFrame(全屏)
34
+ // 改为:CodeView = AddressBar + URL 管理(历史列表 + 快速启动)
35
+ // iframe 渲染交给右侧面板的 PreviewBlock
36
+ ```
37
+
38
+ 修改内容:
39
+
40
+ - 移除 `<PreviewFrame />` 渲染
41
+ - 地址栏输入 URL 后,不在这里渲染 iframe
42
+ - 改为:右侧面板自动展开 Preview 区块并加载 URL
43
+ - 地址栏保留:前进/后退/刷新/关闭按钮 + URL 输入
44
+
45
+ ### 2.2 右侧面板新增 `PreviewBlock` 组件
46
+
47
+ ```typescript
48
+ // 新文件:components/right/PreviewBlock.tsx
49
+ // 在 Code Tab 下显示,Cowork/Chat 模式下隐藏或折叠
50
+
51
+ export function PreviewBlock() {
52
+ const currentTab = usePreviewStore(s => s.currentTab);
53
+ const isCodeTab = useViewStore(s => s.centerTab === "code");
54
+
55
+ if (!isCodeTab || !currentTab) return null; // 非 Code 模式或无标签时隐藏
56
+
57
+ return (
58
+ <div className="...">
59
+ {/* 标题栏 */}
60
+ <div className="flex items-center justify-between px-4 py-3">
61
+ <span>Preview</span>
62
+ <span className="text-xs">{currentTab.url}</span>
63
+ </div>
64
+ {/* 元素选择工具栏 */}
65
+ <ElementPickerToolbar />
66
+ {/* iframe 浏览器 */}
67
+ <PreviewFrame tab={currentTab} useIframe={true} />
68
+ {/* 选中的元素选择器 */}
69
+ <SelectedElementBar />
70
+ </div>
71
+ );
72
+ }
73
+ ```
74
+
75
+ ### 2.3 新增 `ElementPicker` 元素选择器
76
+
77
+ ```typescript
78
+ // 新文件:components/right/ElementPicker.tsx
79
+ // 注入 JS 到 iframe,实现 inspect 模式
80
+
81
+ export function ElementPicker() {
82
+ const [active, setActive] = useState(false);
83
+ const [selectedSelector, setSelectedSelector] = useState("");
84
+
85
+ const togglePicker = () => {
86
+ setActive(!active);
87
+ // 通过 postMessage 向 iframe 注入 inspect 脚本
88
+ iframeRef.contentWindow.postMessage({
89
+ type: "TOGGLE_INSPECT",
90
+ active: !active,
91
+ }, "*");
92
+ };
93
+
94
+ const copyToInput = () => {
95
+ // 将 selector 添加到聊天输入框
96
+ // 通过 clipboard 或直接写入 store
97
+ navigator.clipboard.writeText(selectedSelector);
98
+ };
99
+
100
+ return (
101
+ <div className="...">
102
+ <button onClick={togglePicker} className={active ? "active" : ""}>
103
+ 🎯 选取元素
104
+ </button>
105
+ {selectedSelector && (
106
+ <div>
107
+ <code>{selectedSelector}</code>
108
+ <button onClick={copyToInput}>📋 添加到输入框</button>
109
+ </div>
110
+ )}
111
+ </div>
112
+ );
113
+ }
114
+ ```
115
+
116
+ #### 元素选择器技术方案
117
+
118
+ 跨域问题:对于同源页面(`localhost`),可以直接用 `iframe.contentDocument`;
119
+ 对于非同源页面,需要:
120
+
121
+ 1. 在 iframe URL 后拼接 `?inspector=1`,让目标页面加载一个 inject script
122
+ 2. 或者后端代理请求,注入 inspect JS
123
+ 3. MVP 阶段:**只支持同源(localhost)页面**的元素选取,用 `postMessage` + iframe 内容脚本
124
+
125
+ ```
126
+ 用户点击"选取元素"
127
+
128
+ iframe 加载注入脚本(同源时直接操作 DOM)
129
+
130
+ 用户 hover/click 元素 → 高亮 + 提取 CSS selector
131
+
132
+ postMessage({type: "ELEMENT_SELECTED", selector: ".btn-primary"}) 发回主页面
133
+
134
+ ElementPicker 显示 selector,用户点击"添加到输入框"
135
+
136
+ selector 写入聊天输入框
137
+ ```
138
+
139
+ ### 2.4 AppLayout 更新 — 右侧面板根据 Tab 显示不同内容
140
+
141
+ ```typescript
142
+ // 右栏内容分区:
143
+ // Cowork 模式:Progress + Artifacts + Context
144
+ // Code 模式:Progress + Preview(替换 Context) + Artifacts
145
+ // Chat 模式:隐藏
146
+
147
+ {showRightPanel && centerTab === "cowork" && (
148
+ <div className="w-[300px] ...">
149
+ <ProgressPanel />
150
+ <ArtifactsPanel />
151
+ <ContextPanel />
152
+ </div>
153
+ )}
154
+ {showRightPanel && centerTab === "code" && (
155
+ <div className="w-[300px] ...">
156
+ <ProgressPanel />
157
+ <ArtifactsPanel />
158
+ <PreviewBlock /> {/* 新增 */}
159
+ </div>
160
+ )}
161
+ ```
162
+
163
+ ### 2.5 交互流程
164
+
165
+ ```
166
+ 用户在聊天中让 AI 帮忙调试前端
167
+ → AI 回复:"在 localhost:5173 看一下效果"
168
+ → 用户切换到 Code Tab
169
+ → 地址栏已填入 localhost:5173(或用户手动输入)
170
+ → 右侧 Preview 区块加载网页
171
+ → 用户点"选取元素"
172
+ → 在 iframe 中 hover 按钮,高亮显示
173
+ → 点击 → 提取到 .btn-submit 选择器
174
+ → "添加到输入框" → 聊天输入框出现 ".btn-submit"
175
+ → 用户发送:"这个 .btn-submit 按钮的样式有点问题"
176
+ ```
177
+
178
+ ---
179
+
180
+ ## 三、文件清单
181
+
182
+ | 操作 | 文件 | 说明 |
183
+ | ---- | ------------------------------------------------- | ------------------------------------------ |
184
+ | 🆕 | `src/mainview/components/right/PreviewBlock.tsx` | 右侧预览区块(标题 + 工具栏 + iframe) |
185
+ | 🆕 | `src/mainview/components/right/ElementPicker.tsx` | 元素选择器(inspect 模式 + selector 提取) |
186
+ | ✏️ | `src/mainview/components/code/CodeView.tsx` | 去掉 iframe 渲染,只留地址栏 + URL 管理 |
187
+ | ✏️ | `src/mainview/components/layout/AppLayout.tsx` | 右侧面板根据 Tab 显示不同内容 |
188
+ | ✏️ | `src/mainview/stores/use-preview-store.ts` | 可能需要加 selectElement action |
189
+
190
+ ---
191
+
192
+ ## 四、Phase 2(可选)
193
+
194
+ - iframe inspect 脚本注入方案(支持非同源页面)
195
+ - 页面截图预览(替代完整 iframe,省内存)
196
+ - 多标签浏览器标签栏
@@ -0,0 +1,150 @@
1
+ # Cowork Code View V4 — 聊天链接触发右侧浏览器
2
+
3
+ > **核心改动**:浏览器不是手动输入 URL 打开的,而是**聊天里出现 localhost 链接,点击后右侧面板自动放大并显示浏览器**。
4
+
5
+ ---
6
+
7
+ ## 一、对照稿件的真实交互
8
+
9
+ ```
10
+ 用户在聊天中说:"看一下 localhost:5173 的效果"
11
+
12
+ AI 回复消息里包含 localhost:5173 链接(带 🌐 图标)
13
+
14
+ 用户点击这个链接
15
+
16
+ 右侧面板自动放大到 40% 宽度(从 300px 扩展到 ~560px)
17
+
18
+ 右侧面板显示浏览器预览(iframe 加载 localhost:5173)
19
+
20
+ 用户可以在右侧浏览 + 选元素
21
+ ```
22
+
23
+ ### 与当前实现的区别
24
+
25
+ | 维度 | 当前(V3) | 目标(V4) |
26
+ | -------------- | ------------------------------------- | --------------------------------------- |
27
+ | 怎么打开浏览器 | 手动在右栏地址栏输入 URL | **聊天里点 localhost 链接** |
28
+ | 右栏默认宽度 | 固定 300px | **点击链接后自动放大到 40%** |
29
+ | 左栏三个 Tab | 内容不同(Cowork=任务,Code=URL历史) | **内容一样**(都是任务列表 + New task) |
30
+ | 中间区域 | Cowork/Chat=聊天,Code=管理界面 | **永远是聊天** |
31
+
32
+ ---
33
+
34
+ ## 二、改动清单
35
+
36
+ ### 2.1 聊天消息渲染 localhost 链接
37
+
38
+ 在 `TaskChat.tsx` 的消息渲染中,检测文本里的 `localhost:xxxx` 或 `http://localhost`,自动渲染为可点击链接:
39
+
40
+ ```tsx
41
+ // 检测 localhost URL
42
+ const LOCALHOST_REGEX = /(https?:\/\/)?localhost:\d+(\/[^\s]*)?/g;
43
+
44
+ function renderTextWithLinks(text: string, onOpenPreview: (url: string) => void) {
45
+ // 将 localhost URL 替换为可点击的链接组件
46
+ const parts = text.split(LOCALHOST_REGEX);
47
+ // ... 渲染:普通文本 + <LocalhostLink> 组件
48
+ }
49
+ ```
50
+
51
+ 链接样式:蓝色文字 + 🌐 图标 + 下划线,hover 加深。
52
+
53
+ ### 2.2 点击链接 → 右栏自动放大 + 打开浏览器
54
+
55
+ ```typescript
56
+ // usePreviewStore 新增
57
+ openFromChat: (url: string) => {
58
+ // 1. 设置 currentTab
59
+ // 2. 通知右栏放大
60
+ useRightPanelStore.getState().setExpandedForPreview(true);
61
+ // 3. 加载 URL
62
+ this.openUrl(url);
63
+ };
64
+ ```
65
+
66
+ ### 2.3 右栏 store 新增"预览放大"模式
67
+
68
+ ```typescript
69
+ // useRightPanelStore 新增
70
+ interface RightPanelState {
71
+ // ... 现有
72
+ expandedForPreview: boolean; // 点击聊天链接后自动放大
73
+ setExpandedForPreview: (v: boolean) => void;
74
+ }
75
+
76
+ // AppLayout 渲染时:
77
+ const effectiveRightWidth = expandedForPreview
78
+ ? Math.round(window.innerWidth * 0.4) // 40% 屏宽
79
+ : rpWidth; // 用户手动设置的宽度
80
+ ```
81
+
82
+ ### 2.4 左栏三个 Tab 统一
83
+
84
+ 去掉 TaskSidebar 里 Code Tab 显示 URL 历史的逻辑,**所有 Tab 都显示任务列表 + New task**。Tab 只影响右栏内容:
85
+
86
+ - Cowork → 右栏 = Progress + Artifacts + Context
87
+ - Code → 右栏 = Preview 浏览器(但初始空状态,等聊天链接触发)
88
+ - Chat → 右栏 = 隐藏
89
+
90
+ ### 2.5 右栏 PreviewBlock 空状态优化
91
+
92
+ Code Tab 初始右栏不是地址栏输入,而是:
93
+
94
+ ```
95
+ ┌─────────────────┐
96
+ │ Preview │
97
+ │ │
98
+ │ 🌐 │
99
+ │ 点击聊天中的 │
100
+ │ localhost 链接 │
101
+ │ 打开浏览器预览 │
102
+ │ │
103
+ └─────────────────┘
104
+ ```
105
+
106
+ ---
107
+
108
+ ## 三、文件改动
109
+
110
+ | 操作 | 文件 | 说明 |
111
+ | ---- | ---------------------- | -------------------------------------------------- |
112
+ | ✏️ | `TaskChat.tsx` | 消息文本 localhost 自动链接化 + 点击打开预览 |
113
+ | ✏️ | `use-preview-store.ts` | 新增 openFromChat 方法 |
114
+ | ✏️ | `use-sidebar-store.ts` | useRightPanelStore 新增 expandedForPreview |
115
+ | ✏️ | `AppLayout.tsx` | 右栏宽度根据 expandedForPreview 自动放大 |
116
+ | ✏️ | `TaskSidebar.tsx` | 三个 Tab 统一显示任务列表(去掉 Code 的 URL 历史) |
117
+ | ✏️ | `PreviewBlock.tsx` | 空状态改为"点击聊天链接"提示 |
118
+
119
+ ---
120
+
121
+ ## 四、交互流程图
122
+
123
+ ```
124
+ ┌─────────────────────────────────────────────────────────┐
125
+ │ Cowork Tab │
126
+ │ │
127
+ │ ┌─────┬────────────────────────┬──────────────────┐ │
128
+ │ │ 左栏 │ 中间聊天 │ 右栏 (300px) │ │
129
+ │ │ 任务 │ AI: "看一下效果 🌐 │ Progress │ │
130
+ │ │ 列表 │ localhost:5173" │ Artifacts │ │
131
+ │ │ │ ↑ 点击这个链接 │ Context │ │
132
+ │ │ │ │ │ │
133
+ │ └─────┴────────────────────────┴──────────────────┘ │
134
+ │ │
135
+ │ 点击 localhost:5173 后 → │
136
+ │ │
137
+ │ ┌─────┬────────────────┬──────────────────────┐ │
138
+ │ │ 左栏 │ 中间聊天 │ 右栏 (40%宽,自动放大) │ │
139
+ │ │ 任务 │ │ ┌──────────────────┐ │ │
140
+ │ │ 列表 │ │ │localhost:5173 │ │ │
141
+ │ │ │ │ ├──────────────────┤ │ │
142
+ │ │ │ │ │ │ │ │
143
+ │ │ │ │ │ iframe 浏览器 │ │ │
144
+ │ │ │ │ │ (网页预览) │ │ │
145
+ │ │ │ │ │ │ │ │
146
+ │ │ │ │ └──────────────────┘ │ │
147
+ │ │ │ │ [🎯 选取元素] │ │
148
+ │ └─────┴────────────────┴──────────────────────┘ │
149
+ └─────────────────────────────────────────────────────────┘
150
+ ```
@@ -0,0 +1,27 @@
1
+ import type { ElectrobunConfig } from 'electrobun';
2
+
3
+ export default {
4
+ app: {
5
+ name: 'cowork',
6
+ identifier: 'cowork.piagent.dev',
7
+ version: '0.1.0',
8
+ },
9
+ build: {
10
+ // Vite builds to dist/, we copy from there
11
+ copy: {
12
+ 'dist/index.html': 'views/mainview/index.html',
13
+ 'dist/assets': 'views/mainview/assets',
14
+ },
15
+ // Ignore Vite output in watch mode — HMR handles view rebuilds separately
16
+ watchIgnore: ['dist/**'],
17
+ mac: {
18
+ bundleCEF: false,
19
+ },
20
+ linux: {
21
+ bundleCEF: false,
22
+ },
23
+ win: {
24
+ bundleCEF: false,
25
+ },
26
+ },
27
+ } satisfies ElectrobunConfig;
@@ -0,0 +1,79 @@
1
+ import js from '@eslint/js';
2
+ import tseslint from 'typescript-eslint';
3
+ import rpcPlugin from '@dyyz1993/eslint-plugin-rpc';
4
+ import reactHooks from 'eslint-plugin-react-hooks';
5
+ import reactRefresh from 'eslint-plugin-react-refresh';
6
+ import jsxA11y from 'eslint-plugin-jsx-a11y';
7
+
8
+ export default tseslint.config(
9
+ js.configs.recommended,
10
+ ...tseslint.configs.recommended,
11
+ {
12
+ ignores: [
13
+ 'node_modules/**',
14
+ 'build/**',
15
+ 'dist/**',
16
+ 'dist-electron/**',
17
+ 'electron/**',
18
+ 'postcss.config.js',
19
+ 'tailwind.config.js',
20
+ ],
21
+ },
22
+ {
23
+ files: ['src/**/*.{ts,tsx}'],
24
+ plugins: {
25
+ rpc: rpcPlugin,
26
+ 'react-hooks': reactHooks,
27
+ 'react-refresh': reactRefresh,
28
+ 'jsx-a11y': jsxA11y,
29
+ },
30
+ rules: {
31
+ ...reactHooks.configs.recommended.rules,
32
+ 'react-hooks/rules-of-hooks': 'warn',
33
+ 'react-hooks/exhaustive-deps': 'warn',
34
+ 'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
35
+ ...jsxA11y.configs.recommended.rules,
36
+ 'jsx-a11y/click-events-have-key-events': 'warn',
37
+ 'jsx-a11y/no-static-element-interactions': 'warn',
38
+ 'jsx-a11y/no-autofocus': 'warn',
39
+ // TS 严格规则
40
+ '@typescript-eslint/no-explicit-any': 'error',
41
+ '@typescript-eslint/no-empty-object-type': ['error', { allowObjectTypes: 'always', allowInterfaces: 'with-single-extends' }],
42
+ '@typescript-eslint/no-unused-vars': [
43
+ 'error',
44
+ { argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
45
+ ],
46
+ '@typescript-eslint/ban-ts-comment': ['error', {
47
+ 'ts-expect-error': 'allow-with-description',
48
+ 'ts-ignore': true,
49
+ 'ts-nocheck': true,
50
+ 'ts-check': false,
51
+ minimumDescriptionLength: 3,
52
+ }],
53
+ 'no-empty': ['error', { allowEmptyCatch: true }],
54
+ 'no-console': ['error', { allow: ['warn', 'error'] }],
55
+
56
+ // RPC 规范规则(严格模式,全部 error)
57
+ 'rpc/no-bare-method': 'error',
58
+ 'rpc/no-direct-register': 'error',
59
+ 'rpc/schema-merge-only': 'error',
60
+ 'rpc/module-file-naming': 'error',
61
+ 'rpc/require-typed-register': 'error',
62
+ 'rpc/require-api-client': 'error',
63
+ 'rpc/no-hardcoded-strings': 'warn',
64
+ },
65
+ },
66
+ {
67
+ files: ['src/shared/lib/logger.ts'],
68
+ rules: {
69
+ 'no-console': 'off',
70
+ },
71
+ },
72
+ {
73
+ files: ['src/**/__tests__/**/*.{ts,tsx}'],
74
+ rules: {
75
+ '@typescript-eslint/no-explicit-any': 'off',
76
+ '@typescript-eslint/no-unsafe-function-type': 'off',
77
+ },
78
+ },
79
+ );
@@ -0,0 +1,24 @@
1
+ # Electrobun Project
2
+
3
+ This is an Electrobun desktop application.
4
+
5
+ IMPORTANT: Electrobun is NOT Electron. Do not use Electron APIs or patterns.
6
+
7
+ ## Documentation
8
+
9
+ Full API reference: https://blackboard.sh/electrobun/llms.txt
10
+ Getting started: https://blackboard.sh/electrobun/docs/
11
+
12
+ ## Quick Reference
13
+
14
+ Import patterns:
15
+ - Main process (Bun): `import { BrowserWindow } from "electrobun/bun"`
16
+ - Browser context: `import { Electroview } from "electrobun/view"`
17
+
18
+ Use `views://` URLs to load bundled assets (e.g., `url: "views://mainview/index.html"`).
19
+ Views must be configured in `electrobun.config.ts` to be built and copied into the bundle.
20
+
21
+ ## About
22
+
23
+ Electrobun is built by Blackboard (https://blackboard.sh), an innovation lab building
24
+ tools and funding teams that define the next generation of technology.
@@ -0,0 +1,87 @@
1
+ {
2
+ "name": "cowork-app",
3
+ "version": "1.0.2",
4
+ "description": "Cowork task collaboration agent: AI-powered task orchestration with progress tracking, artifacts, and context management (Desktop + Web)",
5
+ "author": {
6
+ "name": "xuyingzhou",
7
+ "email": "xuyingzhou@tuzhanai.com"
8
+ },
9
+ "homepage": "https://github.com/dyyz1993/pi-agent-template",
10
+ "scripts": {
11
+ "start": "vite build && electrobun dev",
12
+ "dev": "electrobun dev --watch",
13
+ "dev:web": "bun scripts/dev.ts",
14
+ "dev:server": "bun src/server.ts",
15
+ "build": "vite build",
16
+ "build:canary": "vite build && electrobun build --env=canary",
17
+ "build:mac": "vite build && electrobun build --env=canary",
18
+ "build:win": "vite build && electrobun build --env=canary",
19
+ "build:linux": "vite build && electrobun build --env=canary",
20
+ "lint": "eslint .",
21
+ "lint:fix": "eslint . --fix",
22
+ "format": "prettier --write .",
23
+ "format:check": "prettier --check .",
24
+ "test": "vitest run",
25
+ "test:watch": "vitest",
26
+ "test:coverage": "vitest run --coverage",
27
+ "prepare": "husky"
28
+ },
29
+ "dependencies": {
30
+ "@dyyz1993/rpc-core": "^2.2.1",
31
+ "@tanstack/react-virtual": "^3.13.24",
32
+ "electrobun": "1.18.1",
33
+ "lucide-react": "^1.9.0",
34
+ "react": "^18.3.1",
35
+ "i18next": "^24.2.2",
36
+ "i18next-browser-languagedetector": "^8.0.4",
37
+ "react-dom": "^18.3.1",
38
+ "react-i18next": "^15.4.1",
39
+ "react-markdown": "^10.1.0",
40
+ "remark-gfm": "^4.0.1",
41
+ "zustand": "^5.0.12"
42
+ },
43
+ "devDependencies": {
44
+ "@dyyz1993/eslint-plugin-rpc": "^1.1.0",
45
+ "@eslint/js": "^9.0.0",
46
+ "@testing-library/jest-dom": "^6.9.1",
47
+ "@testing-library/react": "^16.3.2",
48
+ "@testing-library/user-event": "^14.6.1",
49
+ "@types/bun": "latest",
50
+ "@types/react": "^18.3.12",
51
+ "@types/react-dom": "^18.3.1",
52
+ "@types/ws": "^8.18.1",
53
+ "@vitejs/plugin-react": "^4.3.4",
54
+ "autoprefixer": "^10.4.20",
55
+ "concurrently": "^9.1.0",
56
+ "eslint": "^9.0.0",
57
+ "eslint-plugin-jsx-a11y": "^6.10.0",
58
+ "eslint-plugin-react-hooks": "^5.2.0",
59
+ "eslint-plugin-react-refresh": "^0.4.20",
60
+ "happy-dom": "^20.9.0",
61
+ "husky": "^9.1.0",
62
+ "jsdom": "^29.1.1",
63
+ "postcss": "^8.4.49",
64
+ "tailwindcss": "^3.4.16",
65
+ "typescript": "^5.7.2",
66
+ "typescript-eslint": "^8.0.0",
67
+ "vite": "^6.0.3",
68
+ "vitest": "^4.1.5",
69
+ "ws": "^8.18.0",
70
+ "@commitlint/cli": "^19.8.1",
71
+ "@commitlint/config-conventional": "^19.8.1",
72
+ "prettier": "^3.5.3",
73
+ "lint-staged": "^15.5.2"
74
+ },
75
+ "lint-staged": {
76
+ "*.{ts,tsx}": [
77
+ "eslint --fix",
78
+ "prettier --write"
79
+ ],
80
+ "*.{json,md,css,html}": [
81
+ "prettier --write"
82
+ ]
83
+ },
84
+ "overrides": {
85
+ "minimatch": "^10.0.1"
86
+ }
87
+ }
@@ -0,0 +1,6 @@
1
+ module.exports = {
2
+ plugins: {
3
+ tailwindcss: {},
4
+ autoprefixer: {},
5
+ },
6
+ };