Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
297 changes: 297 additions & 0 deletions AGENTS.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions apps/electron/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@proma/electron",
"version": "0.7.3",
"version": "0.7.4",
"description": "Proma next gen ai software with general agents - Electron App",
"main": "dist/main.cjs",
"author": {
Expand All @@ -13,7 +13,7 @@
"dev": "concurrently -k -n vite,electron -c blue,green \"bun run dev:vite\" \"bun run dev:electron\"",
"dev:split": "bash scripts/dev-split.sh",
"dev:vite": "vite dev",
"dev:electron": "bun run build:main && bun run build:preload && bun run build:resources && sleep 2 && concurrently -k -n main,preload,app -c yellow,magenta,cyan \"bun run watch:main\" \"bun run watch:preload\" \"bunx electronmon .\"",
"dev:electron": "bun run build:main && bun run build:preload && bun run build:resources && sleep 2 && concurrently -k -n main,preload,app -c yellow,magenta,cyan \"bun run watch:main\" \"bun run watch:preload\" \"NODE_ENV=development bunx electronmon .\"",
"build:main": "esbuild src/main/index.ts --bundle --platform=node --format=cjs --outfile=dist/main.cjs --external:electron --external:@anthropic-ai/claude-agent-sdk",
"build:preload": "esbuild src/preload/index.ts --bundle --platform=node --format=cjs --outfile=dist/preload.cjs --external:electron",
"watch:main": "esbuild src/main/index.ts --bundle --platform=node --format=cjs --outfile=dist/main.cjs --external:electron --external:@anthropic-ai/claude-agent-sdk --watch=forever",
Expand Down
27 changes: 12 additions & 15 deletions apps/electron/src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import { initAutoUpdater, cleanupUpdater } from './lib/updater/auto-updater'
import { startWorkspaceWatcher, stopWorkspaceWatcher } from './lib/workspace-watcher'
import { startChatToolsWatcher, stopChatToolsWatcher } from './lib/chat-tools-watcher'
import { getIsQuitting, setQuitting } from './lib/app-lifecycle'
import { feishuBridge } from './lib/feishu-bridge'
import { getFeishuConfig } from './lib/feishu-config'
import { feishuBotManager } from './lib/feishu-bot-manager'
import { listFeishuBots } from './lib/feishu-bot-config'

let mainWindow: BrowserWindow | null = null

Expand Down Expand Up @@ -112,10 +112,9 @@ function createWindow(): void {
})

// Load the renderer
const isDev = !app.isPackaged
if (isDev) {
mainWindow.loadURL('http://localhost:5173')
mainWindow.webContents.openDevTools()
// 开发模式使用 Vite 服务器,生产模式使用本地文件
if (process.env.NODE_ENV === 'development') {
mainWindow.loadURL('http://localhost:5173/')
} else {
mainWindow.loadFile(join(__dirname, 'renderer', 'index.html'))
}
Expand All @@ -128,8 +127,6 @@ function createWindow(): void {

// 拦截页面内导航,外部链接用系统浏览器打开,防止 Electron 窗口被覆盖
mainWindow.webContents.on('will-navigate', (event, url) => {
// 允许开发模式下的 Vite HMR 热重载
if (isDev && url.startsWith('http://localhost:')) return
event.preventDefault()
if (url.startsWith('http://') || url.startsWith('https://')) {
shell.openExternal(url)
Expand Down Expand Up @@ -203,11 +200,11 @@ app.whenReady().then(async () => {
initAutoUpdater(mainWindow)
}

// 飞书 Bridge 自动启动(配置启用时
const feishuConfig = getFeishuConfig()
if (feishuConfig.enabled && feishuConfig.appId && feishuConfig.appSecret) {
feishuBridge.start().catch((err) => {
console.error('[飞书 Bridge] 自动启动失败:', err)
// 飞书 Bot 自动启动(启动所有已启用的 Bots
const bots = listFeishuBots().filter((b) => b.enabled)
if (bots.length > 0) {
feishuBotManager.startAllEnabled(bots).catch((err) => {
console.error('[飞书 Bot] 自动启动失败:', err)
})
}

Expand Down Expand Up @@ -243,8 +240,8 @@ app.on('before-quit', () => {
stopWorkspaceWatcher()
// 停止 Chat 工具配置文件监听
stopChatToolsWatcher()
// 停止飞书 Bridge
feishuBridge.stop()
// 停止所有飞书 Bot
feishuBotManager.stopAll()
// Clean up system tray before quitting
destroyTray()
})
Loading