uwonbot 1.0.6 → 1.0.7
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/bin/uwonbot.js +16 -4
- package/package.json +1 -1
- package/src/agent.js +30 -0
package/bin/uwonbot.js
CHANGED
|
@@ -12,7 +12,7 @@ showBanner();
|
|
|
12
12
|
program
|
|
13
13
|
.name('uwonbot')
|
|
14
14
|
.description('Uwonbot AI Assistant — Your AI controls your computer')
|
|
15
|
-
.version('1.0.
|
|
15
|
+
.version('1.0.7');
|
|
16
16
|
|
|
17
17
|
program
|
|
18
18
|
.command('login')
|
|
@@ -42,18 +42,30 @@ program
|
|
|
42
42
|
program
|
|
43
43
|
.command('chat [assistantName]')
|
|
44
44
|
.description('Start chatting with an AI assistant')
|
|
45
|
-
.
|
|
45
|
+
.option('-n, --name <name>', 'Assistant name to launch directly')
|
|
46
|
+
.action(async (assistantName, opts) => {
|
|
46
47
|
const config = getConfig();
|
|
47
48
|
if (!config.get('uid')) {
|
|
48
49
|
console.log('\n ⚠️ Please log in first: uwonbot login\n');
|
|
49
50
|
process.exit(1);
|
|
50
51
|
}
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
const targetName = opts.name || assistantName;
|
|
53
|
+
if (targetName) {
|
|
54
|
+
await startChat(targetName);
|
|
53
55
|
} else {
|
|
54
56
|
const assistant = await selectAssistant();
|
|
55
57
|
if (assistant) {
|
|
56
58
|
await startChat(null, assistant);
|
|
59
|
+
} else {
|
|
60
|
+
const defaultBot = {
|
|
61
|
+
name: 'Uwonbot',
|
|
62
|
+
avatar: '🤖',
|
|
63
|
+
brain: 'default',
|
|
64
|
+
voiceLang: 'ko-KR',
|
|
65
|
+
voiceStyle: 'male',
|
|
66
|
+
isDefaultBot: true,
|
|
67
|
+
};
|
|
68
|
+
await startChat(null, defaultBot);
|
|
57
69
|
}
|
|
58
70
|
}
|
|
59
71
|
});
|
package/package.json
CHANGED
package/src/agent.js
CHANGED
|
@@ -194,6 +194,33 @@ async function openApp(appName) {
|
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
+
async function openTerminalWithChat(assistantName) {
|
|
198
|
+
const name = assistantName || 'uwonbot';
|
|
199
|
+
try {
|
|
200
|
+
if (platform === 'darwin') {
|
|
201
|
+
await execAsync(`osascript -e 'tell application "Terminal"
|
|
202
|
+
activate
|
|
203
|
+
do script "uwonbot chat --name \\"${name}\\""
|
|
204
|
+
end tell'`);
|
|
205
|
+
} else if (platform === 'win32') {
|
|
206
|
+
await execAsync(`start cmd /k "uwonbot chat --name \\"${name}\\""`);
|
|
207
|
+
} else {
|
|
208
|
+
const terminals = ['gnome-terminal', 'xterm', 'konsole', 'xfce4-terminal'];
|
|
209
|
+
for (const t of terminals) {
|
|
210
|
+
try {
|
|
211
|
+
await execAsync(`which ${t}`);
|
|
212
|
+
await execAsync(`${t} -- uwonbot chat --name "${name}"`);
|
|
213
|
+
return true;
|
|
214
|
+
} catch {}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return true;
|
|
218
|
+
} catch (e) {
|
|
219
|
+
console.error(chalk.red(' Terminal open failed:'), e.message);
|
|
220
|
+
return false;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
197
224
|
async function handleCommand(msg) {
|
|
198
225
|
try {
|
|
199
226
|
const cmd = JSON.parse(msg);
|
|
@@ -231,6 +258,9 @@ async function handleCommand(msg) {
|
|
|
231
258
|
case 'screen_size':
|
|
232
259
|
const size = await getScreenSize();
|
|
233
260
|
return { ok: true, ...size };
|
|
261
|
+
case 'open_terminal':
|
|
262
|
+
const termOk = await openTerminalWithChat(cmd.assistantName || cmd.name);
|
|
263
|
+
return { ok: termOk };
|
|
234
264
|
case 'ping':
|
|
235
265
|
return { ok: true, pong: true };
|
|
236
266
|
default:
|