@yeaft/webchat-agent 0.1.224 → 0.1.226
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/conductor/actor.js +478 -0
- package/conductor/claudemd-generator.js +194 -0
- package/conductor/conductor-claude.js +472 -0
- package/conductor/index.js +65 -0
- package/conductor/orchestrator-flows.js +498 -0
- package/conductor/orchestrator.js +888 -0
- package/conductor/persistence.js +297 -0
- package/conductor/personas/dev.js +97 -0
- package/conductor/personas/index.js +77 -0
- package/conductor/personas/trading.js +92 -0
- package/conductor/personas/video.js +75 -0
- package/conductor/personas/writing.js +82 -0
- package/conductor/semaphore.js +73 -0
- package/conductor/session.js +208 -0
- package/conductor/specialties/common.js +350 -0
- package/conductor/specialties/index.js +135 -0
- package/conductor/specialties/trading.js +165 -0
- package/conductor/specialties/video.js +175 -0
- package/conductor/specialties/writing.js +120 -0
- package/conductor/task.js +333 -0
- package/conductor/ui-messages.js +170 -0
- package/conductor/worktree.js +182 -0
- package/conductor.js +21 -32
- package/connection/message-router.js +10 -32
- package/package.json +2 -8
- package/scripts/agent-tray.ps1 +0 -134
- package/scripts/create-startup-shortcut.ps1 +0 -18
- package/scripts/ecosystem.config.cjs +0 -46
- package/scripts/pm2-start.ps1 +0 -59
- package/scripts/start-with-tray.ps1 +0 -36
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
// 加载 .env 文件
|
|
2
|
-
const fs = require('fs');
|
|
3
|
-
const path = require('path');
|
|
4
|
-
|
|
5
|
-
function loadEnv() {
|
|
6
|
-
const agentDir = path.join(__dirname, '..');
|
|
7
|
-
const envPath = path.join(agentDir, '.env');
|
|
8
|
-
const env = { NODE_ENV: 'production' };
|
|
9
|
-
|
|
10
|
-
if (fs.existsSync(envPath)) {
|
|
11
|
-
const content = fs.readFileSync(envPath, 'utf-8');
|
|
12
|
-
for (const line of content.split('\n')) {
|
|
13
|
-
const match = line.match(/^\s*([^#][^=]*)\s*=\s*(.*)$/);
|
|
14
|
-
if (match) {
|
|
15
|
-
const key = match[1].trim();
|
|
16
|
-
let value = match[2].trim();
|
|
17
|
-
// 移除引号
|
|
18
|
-
value = value.replace(/^["']|["']$/g, '');
|
|
19
|
-
env[key] = value;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return env;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
module.exports = {
|
|
27
|
-
apps: [{
|
|
28
|
-
name: 'claude-agent',
|
|
29
|
-
script: 'cli.js',
|
|
30
|
-
cwd: path.join(__dirname, '..'),
|
|
31
|
-
// 从 .env 文件加载环境变量
|
|
32
|
-
env: loadEnv(),
|
|
33
|
-
// 自动重启配置
|
|
34
|
-
autorestart: true,
|
|
35
|
-
watch: false,
|
|
36
|
-
max_restarts: 10,
|
|
37
|
-
restart_delay: 5000,
|
|
38
|
-
// 日志配置
|
|
39
|
-
log_date_format: 'YYYY-MM-DD HH:mm:ss',
|
|
40
|
-
error_file: 'logs/error.log',
|
|
41
|
-
out_file: 'logs/out.log',
|
|
42
|
-
merge_logs: true,
|
|
43
|
-
// 内存超限自动重启
|
|
44
|
-
max_memory_restart: '500M',
|
|
45
|
-
}]
|
|
46
|
-
};
|
package/scripts/pm2-start.ps1
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
# Claude Agent PM2 托管启动脚本
|
|
2
|
-
# 用法: .\pm2-start.ps1
|
|
3
|
-
|
|
4
|
-
$ErrorActionPreference = "Stop"
|
|
5
|
-
$AgentDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
6
|
-
|
|
7
|
-
# 切换到 agent 目录
|
|
8
|
-
Set-Location $AgentDir
|
|
9
|
-
|
|
10
|
-
# 检查 pm2 是否安装
|
|
11
|
-
$pm2Path = Get-Command pm2 -ErrorAction SilentlyContinue
|
|
12
|
-
if (-not $pm2Path) {
|
|
13
|
-
Write-Host "Installing pm2 globally..." -ForegroundColor Yellow
|
|
14
|
-
npm install -g pm2
|
|
15
|
-
# Windows 上需要安装 pm2-windows-startup
|
|
16
|
-
npm install -g pm2-windows-startup
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
# 安装依赖 (每次都检查确保完整)
|
|
20
|
-
Write-Host "Checking dependencies..." -ForegroundColor Yellow
|
|
21
|
-
npm install --silent
|
|
22
|
-
if ($LASTEXITCODE -ne 0) {
|
|
23
|
-
Write-Host "Failed to install dependencies!" -ForegroundColor Red
|
|
24
|
-
exit 1
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
# 检查 .env 文件
|
|
28
|
-
if (-not (Test-Path ".env")) {
|
|
29
|
-
Write-Host "No .env file found. Creating from .env.example..." -ForegroundColor Yellow
|
|
30
|
-
if (Test-Path ".env.example") {
|
|
31
|
-
Copy-Item ".env.example" ".env"
|
|
32
|
-
Write-Host "Please edit .env with your configuration, then run this script again." -ForegroundColor Red
|
|
33
|
-
exit 1
|
|
34
|
-
} else {
|
|
35
|
-
Write-Host "No .env.example found!" -ForegroundColor Red
|
|
36
|
-
exit 1
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
# 启动 pm2
|
|
41
|
-
Write-Host ""
|
|
42
|
-
Write-Host "Starting Claude Agent with pm2..." -ForegroundColor Green
|
|
43
|
-
pm2 start ecosystem.config.cjs
|
|
44
|
-
|
|
45
|
-
Write-Host ""
|
|
46
|
-
Write-Host "Agent started!" -ForegroundColor Green
|
|
47
|
-
Write-Host ""
|
|
48
|
-
Write-Host "Management commands:" -ForegroundColor Cyan
|
|
49
|
-
Write-Host " pm2 status - Check status"
|
|
50
|
-
Write-Host " pm2 logs claude-agent - View logs (follow mode)"
|
|
51
|
-
Write-Host " pm2 logs claude-agent --lines 100 - View last 100 lines"
|
|
52
|
-
Write-Host " pm2 stop claude-agent - Stop agent"
|
|
53
|
-
Write-Host " pm2 restart claude-agent - Restart agent"
|
|
54
|
-
Write-Host " pm2 delete claude-agent - Remove from pm2"
|
|
55
|
-
Write-Host ""
|
|
56
|
-
Write-Host "To enable startup on Windows boot:" -ForegroundColor Yellow
|
|
57
|
-
Write-Host " 1. pm2 save"
|
|
58
|
-
Write-Host " 2. pm2-startup install"
|
|
59
|
-
Write-Host ""
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
# 启动 Claude Agent (pm2 托管) + 托盘图标
|
|
2
|
-
$AgentDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
3
|
-
Set-Location $AgentDir
|
|
4
|
-
|
|
5
|
-
# 检查 pm2
|
|
6
|
-
$pm2 = Get-Command pm2 -ErrorAction SilentlyContinue
|
|
7
|
-
if (-not $pm2) {
|
|
8
|
-
Write-Host "Installing pm2..." -ForegroundColor Yellow
|
|
9
|
-
npm install -g pm2
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
# 检查并安装 pm2-logrotate
|
|
13
|
-
$logrotateInstalled = pm2 list 2>$null | Select-String "pm2-logrotate"
|
|
14
|
-
if (-not $logrotateInstalled) {
|
|
15
|
-
Write-Host "Installing pm2-logrotate..." -ForegroundColor Yellow
|
|
16
|
-
pm2 install pm2-logrotate
|
|
17
|
-
# 配置 logrotate
|
|
18
|
-
pm2 set pm2-logrotate:max_size 10M
|
|
19
|
-
pm2 set pm2-logrotate:retain 7
|
|
20
|
-
pm2 set pm2-logrotate:compress true
|
|
21
|
-
Write-Host "pm2-logrotate configured (max 10MB, keep 7 files)" -ForegroundColor Cyan
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
# 先停止已有进程,确保干净启动
|
|
25
|
-
Write-Host "Checking existing processes..." -ForegroundColor Gray
|
|
26
|
-
pm2 delete claude-agent 2>$null | Out-Null
|
|
27
|
-
|
|
28
|
-
# 启动 agent
|
|
29
|
-
Write-Host "Starting Claude Agent..." -ForegroundColor Green
|
|
30
|
-
pm2 start ecosystem.config.cjs
|
|
31
|
-
|
|
32
|
-
# 启动托盘(隐藏窗口)
|
|
33
|
-
Write-Host "Starting tray icon..." -ForegroundColor Green
|
|
34
|
-
Start-Process powershell -ArgumentList "-WindowStyle Hidden -File `"$AgentDir\agent-tray.ps1`"" -WindowStyle Hidden
|
|
35
|
-
|
|
36
|
-
Write-Host "Done! Check the system tray." -ForegroundColor Green
|