@agent-webui/ai-desk-daemon 1.0.19 → 1.0.22
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/README.md +1 -13
- package/dist/darwin-arm64/ai-desk-daemon +0 -0
- package/dist/darwin-x64/ai-desk-daemon +0 -0
- package/dist/linux-arm64/ai-desk-daemon +0 -0
- package/dist/linux-x64/ai-desk-daemon +0 -0
- package/dist/win32-x64/ai-desk-daemon.exe +0 -0
- package/lib/platform.js +1 -1
- package/package.json +7 -3
- package/scripts/postinstall.js +9 -150
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
26
|
# 全局安装
|
|
27
|
-
npm install -g
|
|
27
|
+
npm install -g agent-webui/ai-desk-daemon
|
|
28
28
|
|
|
29
29
|
# 启动 daemon
|
|
30
30
|
aidesk start
|
|
@@ -33,18 +33,6 @@ aidesk start
|
|
|
33
33
|
aidesk status
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
**⚠️ 如果遇到 E401 错误**:
|
|
37
|
-
|
|
38
|
-
如果你看到类似 `401 Unauthorized - GET https://npm.pkg.github.com/@agent-webui%2fai-desk-daemon` 的错误,说明你的 npm 配置指向了 GitHub Packages。请运行:
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
# 临时解决(仅本次安装)
|
|
42
|
-
npm install -g @agent-webui/ai-desk-daemon --registry=https://registry.npmjs.org/
|
|
43
|
-
|
|
44
|
-
# 永久解决(推荐)
|
|
45
|
-
npm config set @agent-webui:registry https://registry.npmjs.org/
|
|
46
|
-
```
|
|
47
|
-
|
|
48
36
|
**包含内容**:
|
|
49
37
|
- ✅ AI Desk Daemon 后台服务
|
|
50
38
|
- ✅ CLI 命令行管理工具
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/lib/platform.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-webui/ai-desk-daemon",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.22",
|
|
4
4
|
"description": "AI Desk Daemon - CLI tool for managing the AI Desk daemon service",
|
|
5
5
|
"main": "lib/daemon-manager.js",
|
|
6
6
|
"bin": {
|
|
@@ -24,9 +24,13 @@
|
|
|
24
24
|
"files": [
|
|
25
25
|
"bin/",
|
|
26
26
|
"lib/",
|
|
27
|
+
"dist/darwin-arm64/",
|
|
28
|
+
"dist/darwin-x64/",
|
|
29
|
+
"dist/linux-arm64/",
|
|
30
|
+
"dist/linux-x64/",
|
|
31
|
+
"dist/win32-x64/",
|
|
27
32
|
"scripts/postinstall.js",
|
|
28
|
-
"README.md"
|
|
29
|
-
".npmrc"
|
|
33
|
+
"README.md"
|
|
30
34
|
],
|
|
31
35
|
"dependencies": {
|
|
32
36
|
"commander": "^11.0.0",
|
package/scripts/postinstall.js
CHANGED
|
@@ -1,157 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Post-install script
|
|
4
|
+
* Post-install script for @agent-webui/ai-desk-daemon
|
|
5
|
+
*
|
|
6
|
+
* This script runs after npm install to verify the installation
|
|
5
7
|
*/
|
|
6
8
|
|
|
7
|
-
const
|
|
8
|
-
const fs = require('fs');
|
|
9
|
-
const path = require('path');
|
|
10
|
-
const { execSync } = require('child_process');
|
|
9
|
+
const chalk = require('chalk');
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
'darwin-x64': 'darwin-x64',
|
|
18
|
-
'darwin-arm64': 'darwin-arm64',
|
|
19
|
-
'linux-x64': 'linux-x64',
|
|
20
|
-
'linux-arm64': 'linux-arm64',
|
|
21
|
-
'win32-x64': 'win32-x64'
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
function getPlatform() {
|
|
25
|
-
const platform = process.platform;
|
|
26
|
-
const arch = process.arch;
|
|
27
|
-
const key = `${platform}-${arch}`;
|
|
28
|
-
|
|
29
|
-
if (!PLATFORM_MAP[key]) {
|
|
30
|
-
console.error(`Unsupported platform: ${platform}-${arch}`);
|
|
31
|
-
console.error('Supported platforms:', Object.keys(PLATFORM_MAP).join(', '));
|
|
32
|
-
process.exit(1);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return PLATFORM_MAP[key];
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function getBinaryName(platform) {
|
|
39
|
-
return platform.startsWith('win32') ? 'ai-desk-daemon.exe' : 'ai-desk-daemon';
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function downloadFile(url, dest) {
|
|
43
|
-
return new Promise((resolve, reject) => {
|
|
44
|
-
console.log(`Downloading from: ${url}`);
|
|
45
|
-
|
|
46
|
-
const file = fs.createWriteStream(dest);
|
|
47
|
-
|
|
48
|
-
https.get(url, (response) => {
|
|
49
|
-
if (response.statusCode === 302 || response.statusCode === 301) {
|
|
50
|
-
// Follow redirect
|
|
51
|
-
file.close();
|
|
52
|
-
fs.unlinkSync(dest);
|
|
53
|
-
return downloadFile(response.headers.location, dest).then(resolve).catch(reject);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (response.statusCode !== 200) {
|
|
57
|
-
file.close();
|
|
58
|
-
fs.unlinkSync(dest);
|
|
59
|
-
return reject(new Error(`Failed to download: HTTP ${response.statusCode}`));
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const totalSize = parseInt(response.headers['content-length'], 10);
|
|
63
|
-
let downloadedSize = 0;
|
|
64
|
-
let lastPercent = 0;
|
|
65
|
-
|
|
66
|
-
response.on('data', (chunk) => {
|
|
67
|
-
downloadedSize += chunk.length;
|
|
68
|
-
const percent = Math.floor((downloadedSize / totalSize) * 100);
|
|
69
|
-
if (percent > lastPercent && percent % 10 === 0) {
|
|
70
|
-
console.log(`Progress: ${percent}%`);
|
|
71
|
-
lastPercent = percent;
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
response.pipe(file);
|
|
76
|
-
|
|
77
|
-
file.on('finish', () => {
|
|
78
|
-
file.close();
|
|
79
|
-
console.log('Download complete!');
|
|
80
|
-
resolve();
|
|
81
|
-
});
|
|
82
|
-
}).on('error', (err) => {
|
|
83
|
-
file.close();
|
|
84
|
-
fs.unlinkSync(dest);
|
|
85
|
-
reject(err);
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
async function main() {
|
|
91
|
-
console.log('='.repeat(50));
|
|
92
|
-
console.log('AI Desk Daemon - Post Install');
|
|
93
|
-
console.log('='.repeat(50));
|
|
94
|
-
|
|
95
|
-
const platform = getPlatform();
|
|
96
|
-
const binaryName = getBinaryName(platform);
|
|
97
|
-
|
|
98
|
-
console.log(`Platform: ${platform}`);
|
|
99
|
-
console.log(`Version: ${PACKAGE_VERSION}`);
|
|
100
|
-
console.log(`Binary: ${binaryName}`);
|
|
101
|
-
console.log('');
|
|
102
|
-
|
|
103
|
-
// Create dist directory
|
|
104
|
-
const distDir = path.join(__dirname, '..', 'dist', platform);
|
|
105
|
-
if (!fs.existsSync(distDir)) {
|
|
106
|
-
fs.mkdirSync(distDir, { recursive: true });
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
const binaryPath = path.join(distDir, binaryName);
|
|
110
|
-
|
|
111
|
-
// Check if binary already exists
|
|
112
|
-
if (fs.existsSync(binaryPath)) {
|
|
113
|
-
console.log('Binary already exists, skipping download.');
|
|
114
|
-
console.log(`Location: ${binaryPath}`);
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// Download from GitHub Releases
|
|
119
|
-
// Format: ai-desk-daemon-darwin-arm64 or ai-desk-daemon-win32-x64.exe
|
|
120
|
-
const assetName = platform.startsWith('win32')
|
|
121
|
-
? `ai-desk-daemon-${platform}.exe`
|
|
122
|
-
: `ai-desk-daemon-${platform}`;
|
|
123
|
-
const downloadUrl = `https://github.com/${GITHUB_REPO}/releases/download/v${PACKAGE_VERSION}/${assetName}`;
|
|
124
|
-
|
|
125
|
-
console.log('Downloading daemon binary...');
|
|
126
|
-
|
|
127
|
-
try {
|
|
128
|
-
await downloadFile(downloadUrl, binaryPath);
|
|
129
|
-
|
|
130
|
-
// Set executable permission (Unix-like systems)
|
|
131
|
-
if (process.platform !== 'win32') {
|
|
132
|
-
fs.chmodSync(binaryPath, 0o755);
|
|
133
|
-
console.log('Set executable permission');
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
console.log('');
|
|
137
|
-
console.log('✓ Installation complete!');
|
|
138
|
-
console.log(`Binary installed at: ${binaryPath}`);
|
|
139
|
-
console.log('');
|
|
140
|
-
console.log('Run "aidesk --help" to get started.');
|
|
141
|
-
console.log('='.repeat(50));
|
|
142
|
-
} catch (error) {
|
|
143
|
-
console.error('');
|
|
144
|
-
console.error('✗ Failed to download daemon binary');
|
|
145
|
-
console.error(`Error: ${error.message}`);
|
|
146
|
-
console.error('');
|
|
147
|
-
console.error('Please try one of the following:');
|
|
148
|
-
console.error(`1. Download manually from: https://github.com/${GITHUB_REPO}/releases/tag/v${PACKAGE_VERSION}`);
|
|
149
|
-
console.error(`2. Place the binary at: ${binaryPath}`);
|
|
150
|
-
console.error('3. Report this issue at: https://github.com/${GITHUB_REPO}/issues');
|
|
151
|
-
console.error('='.repeat(50));
|
|
152
|
-
process.exit(1);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
main();
|
|
11
|
+
console.log('');
|
|
12
|
+
console.log(chalk.green('✓ @agent-webui/ai-desk-daemon installed successfully'));
|
|
13
|
+
console.log('');
|
|
14
|
+
console.log('Run ' + chalk.cyan('aidesk --help') + ' to get started');
|
|
15
|
+
console.log('');
|
|
157
16
|
|