foliko 1.0.20 → 1.0.21

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.
@@ -1,61 +1,62 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "Bash(grep -r \"dotenv\" \"D:/Code/vb-agent/\" --include=\"*.json\" 2>/dev/null | head -20)",
5
- "Bash(cd \"D:/Code/vb-agent\" && pnpm add dotenv)",
6
- "Bash(cd \"D:/Code/vb-agent\" && node -e \"const ai = require\\('ai'\\); console.log\\(Object.keys\\(ai\\).filter\\(k => k.toLowerCase\\(\\).includes\\('reason'\\) || k.toLowerCase\\(\\).includes\\('split'\\) || k.toLowerCase\\(\\).includes\\('think'\\)\\)\\)\")",
7
- "Bash(cd \"D:/Code/vb-agent\" && node -e \"const ai = require\\('ai'\\); console.log\\(typeof ai.extractReasoningMiddleware, ai.extractReasoningMiddleware.toString\\(\\).substring\\(0, 500\\)\\)\")",
8
- "Bash(cd \"D:/Code/vb-agent\" && node -e \"\nconst ai = require\\('ai'\\);\nconsole.log\\('=== extractReasoningMiddleware ==='\\);\nconsole.log\\(ai.extractReasoningMiddleware.toString\\(\\)\\);\nconsole.log\\('\\\\n=== isReasoningUIPart ==='\\);\nconsole.log\\(typeof ai.isReasoningUIPart\\);\n\")",
9
- "Bash(cd \"D:/Code/vb-agent\" && node -e \"const ai = require\\('ai'\\); console.log\\(Object.keys\\(ai\\).filter\\(k => k.toLowerCase\\(\\).includes\\('split'\\)\\)\\)\")",
10
- "Bash(cd \"D:/Code/vb-agent\" && pnpm add ink react)",
11
- "Bash(cd \"D:/Code/vb-agent\" && node cli/bin/foliko.js --help)",
12
- "Bash(cd \"D:/Code/vb-agent\" && timeout 2 node cli/bin/foliko.js chat 2>&1 || true)",
13
- "Bash(cd \"D:/Code/vb-agent\" && node -e \"const mt = require\\('marked-terminal'\\); console.log\\(typeof mt, Object.keys\\(mt\\)\\)\")",
14
- "Bash(cd \"D:/Code/vb-agent\" && timeout 3 node cli/bin/foliko.js chat 2>&1 || true)",
15
- "Bash(echo \"你好\" | node cli/bin/foliko.js chat 2>&1 | head -50)",
16
- "Bash(printf '思考一下1+1等于几\\\\n' | node cli/bin/foliko.js chat 2>&1 | head -100)",
17
- "Bash(printf '1+1等于几\\\\n' | node cli/bin/foliko.js chat 2>&1)",
18
- "Bash(node -e \"\nconst { renderLine } = require\\('./cli/src/utils/markdown'\\)\nconsole.log\\(renderLine\\('🎉 这是一个 emoji'\\)\\)\nconsole.log\\(renderLine\\('**粗体** 和 🎉'\\)\\)\n\")",
19
- "Bash(node -e \"\nconst { render } = require\\('./cli/src/utils/markdown'\\)\nconst text = '🎉 今天是个好日子\\\\n## 标题\\\\n- 列表项1\\\\n- 列表项2'\nconsole.log\\(render\\(text\\)\\)\n\")",
20
- "Bash(node -e \"\nconst { renderLine } = require\\('./cli/src/utils/markdown'\\)\n\n// 模拟emoji被截断的情况\nconst emoji = '🎉'\nconsole.log\\('完整的 emoji:', renderLine\\(emoji\\)\\)\n\n// 模拟截断 - emoji的UTF-8字节是 \\\\xF0\\\\x9F\\\\x8E\\\\x89\nconst partial = '\\\\xF0\\\\x9F' // 不完整的emoji\nconsole.log\\('截断的 emoji:', renderLine\\(partial\\)\\)\n\")",
21
- "Bash(node -e \"\nconst isIncompleteUTF8 = \\(str\\) => {\n if \\(!str || str.length === 0\\) return false\n const lastChar = str.charCodeAt\\(str.length - 1\\)\n if \\(lastChar >= 0x80 && lastChar < 0xC0\\) return true\n return false\n}\n\n// 测试各种emoji\nconst tests = ['🎉', '📁', '⚡', '🛠️', '🔑', '💾', '📝', '⏰', '🔌', '📋']\ntests.forEach\\(e => {\n console.log\\(e, '完整:', !isIncompleteUTF8\\(e\\)\\)\n}\\)\n\n// 测试被截断的emoji \\(只保留第一字节\\)\nconst broken = '🎉'.slice\\(0, 1\\)\nconsole.log\\('截断emoji:', broken, '检测:', isIncompleteUTF8\\(broken\\)\\)\n\")",
22
- "Bash(node -e \"\nconst { renderLine } = require\\('./cli/src/utils/markdown'\\)\nconsole.log\\('测试:', renderLine\\('📁 文件操作:读取、创建'\\)\\)\n\")",
23
- "Bash(node -e \"\nconst hasIncompleteSurrogate = \\(str\\) => {\n if \\(!str || str.length === 0\\) return false\n const lastChar = str.charCodeAt\\(str.length - 1\\)\n console.log\\('检查:', str, 'lastChar:', lastChar.toString\\(16\\), '范围:', \\(lastChar >= 0xD800 && lastChar <= 0xDBFF\\)\\)\n return lastChar >= 0xD800 && lastChar <= 0xDBFF\n}\n\nconst chunk1 = '\\\\xD83C'\nconsole.log\\('结果:', hasIncompleteSurrogate\\(chunk1\\)\\)\n\")",
24
- "Bash(cd D:/Code/vb-agent && node test-stream-emoji.js 2>&1)",
25
- "Read(//d/Date/20260321/app/**)",
26
- "Bash(node -e \":*)",
27
- "Bash(node -e \"\nconst { loadAgentConfig } = require\\('./plugins/default-plugins'\\);\nconst config = loadAgentConfig\\('D:/Date/20260321/app/.agent'\\);\nconsole.log\\('skillsDirs:', config.skillsDirs\\);\n\")",
28
- "Bash(cd D:/Code/vb-agent && pnpm install --shamefully-hoist 2>&1 | head -20)",
29
- "Bash(cd D:/Code/vb-agent && rm -rf node_modules && pnpm install)",
30
- "Bash(cd D:/Code/vb-agent && timeout 8 node test-tg.js 2>&1 || true)",
31
- "Bash(cd D:/Code/vb-agent && timeout 10 node test-tg.js 2>&1 || true)",
32
- "Bash(find /d/Code/vb-agent -name \"*email*\" -type f 2>/dev/null | grep -v node_modules | grep -v .git)",
33
- "Bash(find /d/Code/vb-agent -maxdepth 2 -name \"*.md\" -type f 2>/dev/null | grep -v node_modules)",
34
- "Bash(node -c plugins/default-plugins.js && node -c src/core/plugin-manager.js && echo \"Syntax OK\")",
35
- "Bash(node -c plugins/install-plugin.js && echo \"Syntax OK\")",
36
- "Bash(node -c cli/src/ui/chat-ui.js && echo \"Syntax OK\")",
37
- "Bash(node -c plugins/default-plugins.js && echo \"Syntax OK\")",
38
- "Bash(node -c plugins/scheduler-plugin.js && echo \"Syntax OK\")",
39
- "Bash(node -c plugins/telegram-plugin.js && node -c plugins/scheduler-plugin.js && echo \"Syntax OK\")",
40
- "Bash(node -c plugins/telegram-plugin.js && echo \"Syntax OK\")",
41
- "WebSearch",
42
- "Bash(npm ls:*)",
43
- "Bash(cd node_modules/@pinixai/weixin-bot && npm run build 2>&1)",
44
- "Bash(cd node_modules/@pinixai/weixin-bot && npx tsc 2>&1)",
45
- "Bash(npm install:*)",
46
- "Bash(cd node_modules/@pinixai/weixin-bot && npx typescript --version && npx tsc 2>&1)",
47
- "Bash(npx tsc:*)",
48
- "Bash(node --check /d/Code/vb-agent/plugins/weixin-plugin.js 2>&1)",
49
- "Bash(node --check /d/Code/vb-agent/plugins/telegram-plugin.js && node --check /d/Code/vb-agent/plugins/weixin-plugin.js && echo \"OK\")",
50
- "Bash(node --check /d/Code/vb-agent/cli/src/ui/chat-ui.js && echo \"OK\")",
51
- "Bash(npm uninstall:*)",
52
- "Bash(rm -rf /tmp/weixin-bot && git clone https://github.com/chnak/weixin-bot.git /tmp/weixin-bot 2>&1)",
53
- "Bash(mkdir -p node_modules/@pinixai/weixin-bot && cp -r /tmp/weixin-bot/nodejs/* node_modules/@pinixai/weixin-bot/ && cd node_modules/@pinixai/weixin-bot && npm install 2>&1)",
54
- "Bash(node --check /d/Code/vb-agent/plugins/weixin-plugin.js && echo \"OK\")",
55
- "Bash(node -e \"import\\('@pinixai/weixin-bot'\\).then\\(m => console.log\\('OK:', Object.keys\\(m\\)\\)\\).catch\\(e => console.error\\('Error:', e.message\\)\\)\")",
56
- "Bash(npm run:*)",
57
- "Bash(node -e \"const { WeixinBot } = require\\('@pinixai/weixin-bot'\\); console.log\\(typeof WeixinBot\\)\" 2>&1)",
58
- "Bash(node -e \"import\\('@pinixai/weixin-bot'\\).then\\(m => console.log\\('OK:', typeof m.WeixinBot\\)\\).catch\\(e => console.error\\('Error:', e.message\\)\\)\" 2>&1)"
59
- ]
60
- }
61
- }
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(grep -r \"dotenv\" \"D:/Code/vb-agent/\" --include=\"*.json\" 2>/dev/null | head -20)",
5
+ "Bash(cd \"D:/Code/vb-agent\" && pnpm add dotenv)",
6
+ "Bash(cd \"D:/Code/vb-agent\" && node -e \"const ai = require\\('ai'\\); console.log\\(Object.keys\\(ai\\).filter\\(k => k.toLowerCase\\(\\).includes\\('reason'\\) || k.toLowerCase\\(\\).includes\\('split'\\) || k.toLowerCase\\(\\).includes\\('think'\\)\\)\\)\")",
7
+ "Bash(cd \"D:/Code/vb-agent\" && node -e \"const ai = require\\('ai'\\); console.log\\(typeof ai.extractReasoningMiddleware, ai.extractReasoningMiddleware.toString\\(\\).substring\\(0, 500\\)\\)\")",
8
+ "Bash(cd \"D:/Code/vb-agent\" && node -e \"\nconst ai = require\\('ai'\\);\nconsole.log\\('=== extractReasoningMiddleware ==='\\);\nconsole.log\\(ai.extractReasoningMiddleware.toString\\(\\)\\);\nconsole.log\\('\\\\n=== isReasoningUIPart ==='\\);\nconsole.log\\(typeof ai.isReasoningUIPart\\);\n\")",
9
+ "Bash(cd \"D:/Code/vb-agent\" && node -e \"const ai = require\\('ai'\\); console.log\\(Object.keys\\(ai\\).filter\\(k => k.toLowerCase\\(\\).includes\\('split'\\)\\)\\)\")",
10
+ "Bash(cd \"D:/Code/vb-agent\" && pnpm add ink react)",
11
+ "Bash(cd \"D:/Code/vb-agent\" && node cli/bin/foliko.js --help)",
12
+ "Bash(cd \"D:/Code/vb-agent\" && timeout 2 node cli/bin/foliko.js chat 2>&1 || true)",
13
+ "Bash(cd \"D:/Code/vb-agent\" && node -e \"const mt = require\\('marked-terminal'\\); console.log\\(typeof mt, Object.keys\\(mt\\)\\)\")",
14
+ "Bash(cd \"D:/Code/vb-agent\" && timeout 3 node cli/bin/foliko.js chat 2>&1 || true)",
15
+ "Bash(echo \"你好\" | node cli/bin/foliko.js chat 2>&1 | head -50)",
16
+ "Bash(printf '思考一下1+1等于几\\\\n' | node cli/bin/foliko.js chat 2>&1 | head -100)",
17
+ "Bash(printf '1+1等于几\\\\n' | node cli/bin/foliko.js chat 2>&1)",
18
+ "Bash(node -e \"\nconst { renderLine } = require\\('./cli/src/utils/markdown'\\)\nconsole.log\\(renderLine\\('🎉 这是一个 emoji'\\)\\)\nconsole.log\\(renderLine\\('**粗体** 和 🎉'\\)\\)\n\")",
19
+ "Bash(node -e \"\nconst { render } = require\\('./cli/src/utils/markdown'\\)\nconst text = '🎉 今天是个好日子\\\\n## 标题\\\\n- 列表项1\\\\n- 列表项2'\nconsole.log\\(render\\(text\\)\\)\n\")",
20
+ "Bash(node -e \"\nconst { renderLine } = require\\('./cli/src/utils/markdown'\\)\n\n// 模拟emoji被截断的情况\nconst emoji = '🎉'\nconsole.log\\('完整的 emoji:', renderLine\\(emoji\\)\\)\n\n// 模拟截断 - emoji的UTF-8字节是 \\\\xF0\\\\x9F\\\\x8E\\\\x89\nconst partial = '\\\\xF0\\\\x9F' // 不完整的emoji\nconsole.log\\('截断的 emoji:', renderLine\\(partial\\)\\)\n\")",
21
+ "Bash(node -e \"\nconst isIncompleteUTF8 = \\(str\\) => {\n if \\(!str || str.length === 0\\) return false\n const lastChar = str.charCodeAt\\(str.length - 1\\)\n if \\(lastChar >= 0x80 && lastChar < 0xC0\\) return true\n return false\n}\n\n// 测试各种emoji\nconst tests = ['🎉', '📁', '⚡', '🛠️', '🔑', '💾', '📝', '⏰', '🔌', '📋']\ntests.forEach\\(e => {\n console.log\\(e, '完整:', !isIncompleteUTF8\\(e\\)\\)\n}\\)\n\n// 测试被截断的emoji \\(只保留第一字节\\)\nconst broken = '🎉'.slice\\(0, 1\\)\nconsole.log\\('截断emoji:', broken, '检测:', isIncompleteUTF8\\(broken\\)\\)\n\")",
22
+ "Bash(node -e \"\nconst { renderLine } = require\\('./cli/src/utils/markdown'\\)\nconsole.log\\('测试:', renderLine\\('📁 文件操作:读取、创建'\\)\\)\n\")",
23
+ "Bash(node -e \"\nconst hasIncompleteSurrogate = \\(str\\) => {\n if \\(!str || str.length === 0\\) return false\n const lastChar = str.charCodeAt\\(str.length - 1\\)\n console.log\\('检查:', str, 'lastChar:', lastChar.toString\\(16\\), '范围:', \\(lastChar >= 0xD800 && lastChar <= 0xDBFF\\)\\)\n return lastChar >= 0xD800 && lastChar <= 0xDBFF\n}\n\nconst chunk1 = '\\\\xD83C'\nconsole.log\\('结果:', hasIncompleteSurrogate\\(chunk1\\)\\)\n\")",
24
+ "Bash(cd D:/Code/vb-agent && node test-stream-emoji.js 2>&1)",
25
+ "Read(//d/Date/20260321/app/**)",
26
+ "Bash(node -e \":*)",
27
+ "Bash(node -e \"\nconst { loadAgentConfig } = require\\('./plugins/default-plugins'\\);\nconst config = loadAgentConfig\\('D:/Date/20260321/app/.agent'\\);\nconsole.log\\('skillsDirs:', config.skillsDirs\\);\n\")",
28
+ "Bash(cd D:/Code/vb-agent && pnpm install --shamefully-hoist 2>&1 | head -20)",
29
+ "Bash(cd D:/Code/vb-agent && rm -rf node_modules && pnpm install)",
30
+ "Bash(cd D:/Code/vb-agent && timeout 8 node test-tg.js 2>&1 || true)",
31
+ "Bash(cd D:/Code/vb-agent && timeout 10 node test-tg.js 2>&1 || true)",
32
+ "Bash(find /d/Code/vb-agent -name \"*email*\" -type f 2>/dev/null | grep -v node_modules | grep -v .git)",
33
+ "Bash(find /d/Code/vb-agent -maxdepth 2 -name \"*.md\" -type f 2>/dev/null | grep -v node_modules)",
34
+ "Bash(node -c plugins/default-plugins.js && node -c src/core/plugin-manager.js && echo \"Syntax OK\")",
35
+ "Bash(node -c plugins/install-plugin.js && echo \"Syntax OK\")",
36
+ "Bash(node -c cli/src/ui/chat-ui.js && echo \"Syntax OK\")",
37
+ "Bash(node -c plugins/default-plugins.js && echo \"Syntax OK\")",
38
+ "Bash(node -c plugins/scheduler-plugin.js && echo \"Syntax OK\")",
39
+ "Bash(node -c plugins/telegram-plugin.js && node -c plugins/scheduler-plugin.js && echo \"Syntax OK\")",
40
+ "Bash(node -c plugins/telegram-plugin.js && echo \"Syntax OK\")",
41
+ "WebSearch",
42
+ "Bash(npm ls:*)",
43
+ "Bash(cd node_modules/@pinixai/weixin-bot && npm run build 2>&1)",
44
+ "Bash(cd node_modules/@pinixai/weixin-bot && npx tsc 2>&1)",
45
+ "Bash(npm install:*)",
46
+ "Bash(cd node_modules/@pinixai/weixin-bot && npx typescript --version && npx tsc 2>&1)",
47
+ "Bash(npx tsc:*)",
48
+ "Bash(node --check /d/Code/vb-agent/plugins/weixin-plugin.js 2>&1)",
49
+ "Bash(node --check /d/Code/vb-agent/plugins/telegram-plugin.js && node --check /d/Code/vb-agent/plugins/weixin-plugin.js && echo \"OK\")",
50
+ "Bash(node --check /d/Code/vb-agent/cli/src/ui/chat-ui.js && echo \"OK\")",
51
+ "Bash(npm uninstall:*)",
52
+ "Bash(rm -rf /tmp/weixin-bot && git clone https://github.com/chnak/weixin-bot.git /tmp/weixin-bot 2>&1)",
53
+ "Bash(mkdir -p node_modules/@pinixai/weixin-bot && cp -r /tmp/weixin-bot/nodejs/* node_modules/@pinixai/weixin-bot/ && cd node_modules/@pinixai/weixin-bot && npm install 2>&1)",
54
+ "Bash(node --check /d/Code/vb-agent/plugins/weixin-plugin.js && echo \"OK\")",
55
+ "Bash(node -e \"import\\('@pinixai/weixin-bot'\\).then\\(m => console.log\\('OK:', Object.keys\\(m\\)\\)\\).catch\\(e => console.error\\('Error:', e.message\\)\\)\")",
56
+ "Bash(npm run:*)",
57
+ "Bash(node -e \"const { WeixinBot } = require\\('@pinixai/weixin-bot'\\); console.log\\(typeof WeixinBot\\)\" 2>&1)",
58
+ "Bash(node -e \"import\\('@pinixai/weixin-bot'\\).then\\(m => console.log\\('OK:', typeof m.WeixinBot\\)\\).catch\\(e => console.error\\('Error:', e.message\\)\\)\" 2>&1)",
59
+ "Bash(ls -la D:/code/vb-agent/cli/bin/ && cat D:/code/vb-agent/cli/bin/*.js 2>/dev/null | head -50)"
60
+ ]
61
+ }
62
+ }
package/cli/src/index.js CHANGED
@@ -7,13 +7,13 @@ const { chatCommand } = require('./commands/chat')
7
7
  /**
8
8
  * CLI 主入口
9
9
  */
10
- function cli() {
10
+ async function cli() {
11
11
  const args = process.argv.slice(2)
12
12
  const command = args[0] || 'chat'
13
13
 
14
14
  switch (command) {
15
15
  case 'chat':
16
- chatCommand(args.slice(1))
16
+ await chatCommand(args.slice(1))
17
17
  break
18
18
 
19
19
  case 'help':
package/install.ps1 CHANGED
@@ -1,60 +1,110 @@
1
1
  # Foliko Installer
2
2
 
3
- # Step 1: Fix execution policy first
3
+ # Fix execution policy first
4
4
  Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -Force -ErrorAction SilentlyContinue
5
5
 
6
6
  Write-Host "Foliko Installer"
7
7
  Write-Host "================="
8
8
  Write-Host ""
9
9
 
10
- # Step 2: Refresh PATH
10
+ # Refresh PATH
11
11
  $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
12
12
 
13
- # Step 3: Check and install Git
14
- Write-Host "Checking Git..."
15
- if (-not (Get-Command git -ErrorAction SilentlyContinue)) {
16
- Write-Host "Git not found, installing..."
13
+ # ============ Check/Install Node.js ============
14
+ Write-Host "Checking Node.js..."
15
+ if (Get-Command node -ErrorAction SilentlyContinue) {
16
+ Write-Host "Node.js installed: $(node --version)" -ForegroundColor Green
17
+ } else {
18
+ Write-Host "Node.js not found, installing..." -ForegroundColor Yellow
19
+
20
+ $nodeUrl = "https://nodejs.org/dist/v20.11.0/node-v20.11.0-x64.msi"
21
+ $nodeInstaller = "$env:TEMP\node-installer.msi"
17
22
 
18
- # Download Git for Windows
19
- $gitUrl = "https://github.com/git-for-windows/git/releases/download/v2.44.0.windows.1/MinGit-2.44.0-64-bit.zip"
20
- $gitInstaller = "$env:TEMP\git-installer.zip"
23
+ Write-Host "Downloading Node.js..." -ForegroundColor Cyan
24
+ Invoke-WebRequest -Uri $nodeUrl -OutFile $nodeInstaller -UseBasicParsing
21
25
 
22
- Write-Host "Downloading Git..."
23
- Invoke-WebRequest -Uri $gitUrl -OutFile $gitInstaller -UseBasicParsing
26
+ Write-Host "Installing Node.js (may require admin)..." -ForegroundColor Cyan
27
+ Start-Process msiexec.exe -ArgumentList "/i", $nodeInstaller, "/quiet", "/norestart" -Wait
24
28
 
25
- Write-Host "Installing Git..."
26
- Expand-Archive -Path $gitInstaller -DestinationPath "C:\Git" -Force
27
- $env:Path = "C:\Git\cmd;$env:Path"
29
+ $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
30
+ Start-Sleep -Seconds 3
28
31
 
29
- # Verify
30
- if (Get-Command git -ErrorAction SilentlyContinue) {
31
- Write-Host "Git installed"
32
+ if (Get-Command node -ErrorAction SilentlyContinue) {
33
+ Write-Host "Node.js installed: $(node --version)" -ForegroundColor Green
34
+ Remove-Item $nodeInstaller -Force -ErrorAction SilentlyContinue
32
35
  } else {
33
- Write-Host "Git installation failed. Please install Git manually: https://git-scm.com/download/win"
36
+ Write-Host "Node.js installation failed" -ForegroundColor Red
37
+ Write-Host "Download manually: https://nodejs.org/" -ForegroundColor Yellow
34
38
  }
35
- Remove-Item $gitInstaller -Force -ErrorAction SilentlyContinue
39
+ }
40
+ Write-Host ""
41
+
42
+ # ============ Check/Install Python ============
43
+ Write-Host "Checking Python..."
44
+ if (Get-Command python -ErrorAction SilentlyContinue) {
45
+ Write-Host "Python installed: $(python --version)" -ForegroundColor Green
36
46
  } else {
37
- Write-Host "Git ready"
47
+ Write-Host "Python not found, installing..." -ForegroundColor Yellow
48
+
49
+ $pythonUrl = "https://www.python.org/ftp/python/3.12.1/python-3.12.1-amd64.exe"
50
+ $pythonInstaller = "$env:TEMP\python-installer.exe"
51
+
52
+ Write-Host "Downloading Python..." -ForegroundColor Cyan
53
+ Invoke-WebRequest -Uri $pythonUrl -OutFile $pythonInstaller -UseBasicParsing
54
+
55
+ Write-Host "Installing Python (may require admin)..." -ForegroundColor Cyan
56
+ Start-Process $pythonInstaller -ArgumentList "/quiet", "InstallAllUsers=1", "PrependPath=1", "Include_pip=1" -Wait
57
+
58
+ $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
59
+ Start-Sleep -Seconds 3
60
+
61
+ if (Get-Command python -ErrorAction SilentlyContinue) {
62
+ Write-Host "Python installed: $(python --version)" -ForegroundColor Green
63
+ Remove-Item $pythonInstaller -Force -ErrorAction SilentlyContinue
64
+ } else {
65
+ Write-Host "Python installation failed" -ForegroundColor Red
66
+ Write-Host "Download manually: https://www.python.org/downloads/" -ForegroundColor Yellow
67
+ }
38
68
  }
69
+ Write-Host ""
39
70
 
40
- # Step 4: Check Node.js
41
- Write-Host "Checking Node.js..."
42
- if (-not (Get-Command npm -ErrorAction SilentlyContinue)) {
43
- Write-Host "Node.js not found. Please install Node.js first: https://nodejs.org/"
44
- exit 1
71
+ # ============ Check/Install uv ============
72
+ Write-Host "Checking uv..."
73
+ if (Get-Command uv -ErrorAction SilentlyContinue) {
74
+ Write-Host "uv installed: $(uv --version)" -ForegroundColor Green
75
+ } else {
76
+ Write-Host "uv not found, installing..." -ForegroundColor Yellow
77
+
78
+ Write-Host "Downloading uv..." -ForegroundColor Cyan
79
+ $uvInstaller = "$env:TEMP\uv-installer.pyz"
80
+
81
+ try {
82
+ Invoke-WebRequest -Uri "https://astral.sh/uv/install.ps1" -OutFile "$env:TEMP\install-uv.ps1" -UseBasicParsing
83
+ powershell -ExecutionPolicy Bypass -File "$env:TEMP\install-uv.ps1" -Version "0.4.0" -PowerShell -Admin
84
+ Remove-Item "$env:TEMP\install-uv.ps1" -Force -ErrorAction SilentlyContinue
85
+
86
+ $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
87
+
88
+ if (Get-Command uv -ErrorAction SilentlyContinue) {
89
+ Write-Host "uv installed: $(uv --version)" -ForegroundColor Green
90
+ }
91
+ } catch {
92
+ Write-Host "uv installation failed (optional, can be skipped)" -ForegroundColor Yellow
93
+ }
45
94
  }
46
- Write-Host "Node.js ready"
95
+ Write-Host ""
47
96
 
48
- # Step 5: Install Foliko
97
+ # ============ Install Foliko ============
49
98
  Write-Host "Installing Foliko..."
99
+ $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
100
+
50
101
  npm install -g foliko
51
102
 
52
- # Step 6: Verify
53
103
  if (Get-Command foliko -ErrorAction SilentlyContinue) {
54
104
  Write-Host ""
55
- Write-Host "Installation complete!"
105
+ Write-Host "Installation complete!" -ForegroundColor Green
56
106
  Write-Host "Run: foliko chat"
57
107
  } else {
58
108
  Write-Host ""
59
- Write-Host "Installation may have failed. Try manually: npm install -g foliko"
109
+ Write-Host "Installation may have failed. Try manually: npm install -g foliko" -ForegroundColor Yellow
60
110
  }
package/install.sh CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/bin/bash
2
- # Foliko Installer (macOS/Linux)
2
+ # Foliko Installer
3
3
 
4
4
  set -e
5
5
 
@@ -20,59 +20,48 @@ detect_os() {
20
20
 
21
21
  OS=$(detect_os)
22
22
 
23
- # Check and install Node.js
24
- install_nodejs() {
25
- echo -e "\033[36mChecking Node.js...\033[0m"
26
-
27
- if command -v node &> /dev/null; then
28
- echo -e "\033[32mNode.js installed: $(node --version)\033[0m"
29
- return 0
30
- fi
31
-
23
+ # ============ Check/Install Node.js ============
24
+ echo -e "\033[36mChecking Node.js...\033[0m"
25
+ if command -v node &> /dev/null; then
26
+ echo -e "\033[32mNode.js installed: $(node --version)\033[0m"
27
+ else
32
28
  echo -e "\033[33mNode.js not found, installing...\033[0m"
33
29
 
34
30
  if [[ "$OS" == "macOS" ]]; then
35
31
  if command -v brew &> /dev/null; then
36
32
  brew install node
37
33
  else
38
- echo -e "\033[33mHomebrew not found. Install it first:\033[0m"
34
+ echo -e "\033[31mHomebrew not found. Install it first:\033[0m"
39
35
  echo "/bin/bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\""
40
- return 1
36
+ exit 1
41
37
  fi
42
38
  elif [[ "$OS" == "Linux" ]]; then
43
39
  if command -v apt-get &> /dev/null; then
44
- sudo apt-get update
45
- sudo apt-get install -y nodejs npm
40
+ sudo apt-get update && sudo apt-get install -y nodejs npm
46
41
  elif command -v yum &> /dev/null; then
47
42
  sudo yum install -y nodejs npm
48
43
  elif command -v pacman &> /dev/null; then
49
44
  sudo pacman -S nodejs npm
50
45
  else
51
- echo -e "\033[31mNo supported package manager found. Please install Node.js manually\033[0m"
52
- echo "Download: https://nodejs.org/"
53
- return 1
46
+ echo -e "\033[31mNo package manager found. Install Node.js manually: https://nodejs.org/\033[0m"
47
+ exit 1
54
48
  fi
55
49
  fi
56
50
 
57
51
  if command -v node &> /dev/null; then
58
52
  echo -e "\033[32mNode.js installed: $(node --version)\033[0m"
59
- return 0
60
- fi
61
-
62
- echo -e "\033[31mNode.js installation failed\033[0m"
63
- echo "Download: https://nodejs.org/"
64
- return 1
65
- }
66
-
67
- # Check and install Python
68
- install_python() {
69
- echo -e "\033[36mChecking Python...\033[0m"
70
-
71
- if command -v python3 &> /dev/null; then
72
- echo -e "\033[32mPython installed: $(python3 --version)\033[0m"
73
- return 0
53
+ else
54
+ echo -e "\033[31mNode.js installation failed\033[0m"
55
+ exit 1
74
56
  fi
57
+ fi
58
+ echo ""
75
59
 
60
+ # ============ Check/Install Python ============
61
+ echo -e "\033[36mChecking Python...\033[0m"
62
+ if command -v python3 &> /dev/null; then
63
+ echo -e "\033[32mPython installed: $(python3 --version)\033[0m"
64
+ else
76
65
  echo -e "\033[33mPython not found, installing...\033[0m"
77
66
 
78
67
  if [[ "$OS" == "macOS" ]]; then
@@ -81,8 +70,7 @@ install_python() {
81
70
  fi
82
71
  elif [[ "$OS" == "Linux" ]]; then
83
72
  if command -v apt-get &> /dev/null; then
84
- sudo apt-get update
85
- sudo apt-get install -y python3 python3-venv python3-pip
73
+ sudo apt-get update && sudo apt-get install -y python3 python3-venv python3-pip
86
74
  elif command -v yum &> /dev/null; then
87
75
  sudo yum install -y python3
88
76
  elif command -v pacman &> /dev/null; then
@@ -92,46 +80,42 @@ install_python() {
92
80
 
93
81
  if command -v python3 &> /dev/null; then
94
82
  echo -e "\033[32mPython installed: $(python3 --version)\033[0m"
95
- return 0
83
+ else
84
+ echo -e "\033[33mPython installation failed (optional)\033[0m"
96
85
  fi
97
-
98
- echo -e "\033[33mPython not installed (optional)\033[0m"
99
- return 0
100
- }
101
-
102
- # Main installation
103
- echo -e "\033[36mChecking environment...\033[0m"
104
- echo -e "\033[36m-------------------\033[0m"
86
+ fi
105
87
  echo ""
106
88
 
107
- NODE_OK=0
108
- PYTHON_OK=0
89
+ # ============ Check/Install uv ============
90
+ echo -e "\033[36mChecking uv...\033[0m"
91
+ if command -v uv &> /dev/null; then
92
+ echo -e "\033[32muv installed: $(uv --version)\033[0m"
93
+ else
94
+ echo -e "\033[33muv not found, installing...\033[0m"
109
95
 
110
- install_nodejs || NODE_OK=1
111
- echo ""
112
- install_python || PYTHON_OK=1
113
- echo ""
96
+ if [[ "$OS" == "macOS" ]] || [[ "$OS" == "Linux" ]]; then
97
+ curl -LsSf https://astral.sh/uv/install.sh | sh
98
+ source $HOME/.local/bin/env 2>/dev/null || true
114
99
 
115
- if [[ $NODE_OK -ne 0 ]]; then
116
- echo -e "\033[31mError: Node.js not installed correctly\033[0m"
117
- echo "Please install Node.js first: https://nodejs.org/"
118
- exit 1
100
+ if command -v uv &> /dev/null; then
101
+ echo -e "\033[32muv installed: $(uv --version)\033[0m"
102
+ else
103
+ echo -e "\033[33muv installation failed (optional)\033[0m"
104
+ fi
105
+ fi
119
106
  fi
107
+ echo ""
120
108
 
121
- # Install Foliko
109
+ # ============ Install Foliko ============
122
110
  echo -e "\033[36mInstalling Foliko...\033[0m"
123
111
  npm install -g foliko
124
112
 
125
113
  if command -v foliko &> /dev/null; then
126
114
  echo ""
127
115
  echo -e "\033[32mInstallation complete!\033[0m"
128
- echo ""
129
- echo -e "\033[33mUsage:\033[0m"
130
- echo -e " \033[37mfoliko chat\033[0m"
116
+ echo "Run: foliko chat"
131
117
  else
132
118
  echo ""
133
- echo -e "\033[31mInstallation failed, please try manually:\033[0m"
134
- echo -e " \033[37mnpm install -g foliko\033[0m"
119
+ echo -e "\033[31mInstallation failed. Try manually: npm install -g foliko\033[0m"
120
+ exit 1
135
121
  fi
136
-
137
- echo ""
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foliko",
3
- "version": "1.0.20",
3
+ "version": "1.0.21",
4
4
  "description": "简约的插件化 Agent 框架",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -26,7 +26,7 @@
26
26
  "@ai-sdk/openai-compatible": "^2.0.35",
27
27
  "@anthropic-ai/sdk": "^0.39.0",
28
28
  "@modelcontextprotocol/sdk": "^1.27.1",
29
- "@pinixai/weixin-bot": "git+https://github.com/chnak/weixin-bot.git",
29
+ "@pinixai/weixin-bot": "https://github.com/chnak/weixin-bot.git",
30
30
  "ai": "^6.0.116",
31
31
  "dotenv": "^17.3.1",
32
32
  "imap": "^0.8.19",