@aivin-labs/cli 1.0.8 → 1.0.11
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 +25 -0
- package/bin/assets/aivin-mascot.png +0 -0
- package/bin/cli.mjs +1912 -1780
- package/bin/lib/browserAutomation.mjs +232 -469
- package/bin/lib/localBrowser.mjs +345 -0
- package/bin/lib/remote/activityLog.mjs +1 -1
- package/bin/lib/remote/autoStart.mjs +174 -14
- package/bin/lib/remote/browserTunnel.mjs +142 -31
- package/bin/lib/remote/callLedger.mjs +1 -1
- package/bin/lib/remote/cdpPolicy.mjs +14 -1
- package/bin/lib/remote/client.mjs +87 -5
- package/bin/lib/remote/clipboard.mjs +138 -0
- package/bin/lib/remote/codingAgents.mjs +293 -0
- package/bin/lib/remote/constants.mjs +61 -0
- package/bin/lib/remote/dailyBrowser.mjs +1 -1
- package/bin/lib/remote/desktop/index.mjs +272 -0
- package/bin/lib/remote/desktop/linux.mjs +144 -0
- package/bin/lib/remote/desktop/linuxTraySource.mjs +427 -0
- package/bin/lib/remote/desktop/mac.mjs +187 -0
- package/bin/lib/remote/desktop/macTraySource.mjs +292 -0
- package/bin/lib/remote/desktop/strings.mjs +74 -0
- package/bin/lib/remote/desktop/traySource.mjs +527 -0
- package/bin/lib/remote/docText.mjs +1 -1
- package/bin/lib/remote/fileIndexer.mjs +1 -1
- package/bin/lib/remote/gui/index.mjs +93 -12
- package/bin/lib/remote/gui/windowsHostSource.mjs +280 -28
- package/bin/lib/remote/idempotency.mjs +1 -1
- package/bin/lib/remote/localPolicy.mjs +9 -2
- package/bin/lib/remote/mascot/adpcm.mjs +70 -0
- package/bin/lib/remote/mascot/ask.mjs +768 -0
- package/bin/lib/remote/mascot/askHostSource.mjs +512 -0
- package/bin/lib/remote/mascot/assets.mjs +825 -216
- package/bin/lib/remote/mascot/bot.mjs +372 -0
- package/bin/lib/remote/mascot/hostSource.mjs +498 -101
- package/bin/lib/remote/mascot/hotkey.mjs +66 -0
- package/bin/lib/remote/mascot/index.mjs +199 -28
- package/bin/lib/remote/mascot/labels.mjs +2 -3
- package/bin/lib/remote/mascot/rigSource.mjs +609 -0
- package/bin/lib/remote/mascot/strings.mjs +204 -18
- package/bin/lib/remote/mascot/ui.mjs +104 -0
- package/bin/lib/remote/mascot/voiceSource.mjs +584 -0
- package/bin/lib/remote/meeting/index.mjs +415 -0
- package/bin/lib/remote/meeting/recorder.mjs +109 -0
- package/bin/lib/remote/meeting/recorderSource.mjs +394 -0
- package/bin/lib/remote/meeting/transcribe.mjs +259 -0
- package/bin/lib/remote/tabGroups.mjs +209 -0
- package/bin/lib/remote/toolHandlers.mjs +15 -0
- package/docs/AIVIN_MASCOT.md +116 -0
- package/docs/CLI.md +142 -11
- package/docs/media/aivin-mascot-states.mp4 +0 -0
- package/package.json +1 -1
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import os from 'os';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import WSClient from 'ws';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Gom các tab AI đang làm vào một nhóm tab (tab group) trong cửa sổ Aivin (29/10/2026) — mỗi đường hầm (nhiệm vụ) một nhóm, có tên + màu riêng.
|
|
8
|
+
*
|
|
9
|
+
* CDP không có lệnh nào cho nhóm tab — chỉ API tiện ích `chrome.tabGroups` làm được. Nên CLI ghi một tiện ích nhỏ vào `~/.aivin/browser-extension/
|
|
10
|
+
* tab-groups` và nạp qua CDP (`Extensions.loadUnpacked` — Chrome 137+ bỏ qua `--load-extension`; cần cửa sổ mở với
|
|
11
|
+
* `--enable-unsafe-extension-debugging`, localBrowser.mjs thêm cờ này), rồi chạy hàm `aivinGroup` trong service worker của tiện ích qua một kết nối CDP
|
|
12
|
+
* riêng của CLI. Đích CDP → id tab: `chrome.debugger.getTargets()` (quyền `debugger`; chỉ liệt kê, không gắn vào tab nào).
|
|
13
|
+
*
|
|
14
|
+
* Chỉ cho cửa sổ Aivin: trình duyệt hằng ngày của người dùng không mở với cờ đó và CLI không cài gì vào hồ sơ của họ. Cửa sổ Aivin mở bởi bản CLI cũ
|
|
15
|
+
* (không có cờ) → bỏ qua, không lỗi; đóng mở lại cửa sổ là có. Máy chủ không đụng được tiện ích: cdpPolicy.mjs chặn `Extensions.*` và mọi lệnh vào
|
|
16
|
+
* phiên của đích `chrome-extension://`.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
export const TAB_GROUPS_SW_FILE = 'aivin-tab-groups.js';
|
|
20
|
+
export const TAB_GROUPS_EXTENSION_DIR = path.join(os.homedir(), '.aivin', 'browser-extension', 'tab-groups');
|
|
21
|
+
/** Màu của Chrome cho nhóm tab — xoay vòng để các nhiệm vụ chạy song song phân biệt được. */
|
|
22
|
+
export const GROUP_COLORS = ['blue', 'purple', 'cyan', 'green', 'orange', 'pink', 'yellow', 'red'];
|
|
23
|
+
const CALL_TIMEOUT_MS = 5000;
|
|
24
|
+
|
|
25
|
+
const MANIFEST = {
|
|
26
|
+
manifest_version: 3,
|
|
27
|
+
name: 'Aivin tab groups',
|
|
28
|
+
version: '1.0.0',
|
|
29
|
+
description: 'Groups the tabs Aivin\'s AI Browser is working in. Loaded by the aivin CLI.',
|
|
30
|
+
permissions: ['tabGroups', 'debugger'],
|
|
31
|
+
background: { service_worker: TAB_GROUPS_SW_FILE },
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// Nhúng dạng chuỗi (không phải tệp trong gói): bản chạy một tệp (bun build) không mang theo thư mục tài nguyên.
|
|
35
|
+
const SW_SOURCE = `// Aivin tab groups - written by the aivin CLI, which calls aivinGroup() over CDP.
|
|
36
|
+
// Keep the worker alive: Chrome stops an idle service worker after 30 s, any extension API call resets that timer.
|
|
37
|
+
setInterval(() => chrome.runtime.getPlatformInfo(), 20000);
|
|
38
|
+
|
|
39
|
+
/** Groups the tabs behind CDP target ids into groupId (if it still exists) or a new group. Returns the group id, or null. */
|
|
40
|
+
self.aivinGroup = async ({ targetIds, groupId, title, color }) => {
|
|
41
|
+
let tabIds = [];
|
|
42
|
+
// The tab may not be listed yet right after Target.createTarget returns.
|
|
43
|
+
for (let i = 0; i < 20; i++) {
|
|
44
|
+
const targets = await chrome.debugger.getTargets();
|
|
45
|
+
tabIds = targets.filter((t) => targetIds.includes(t.id) && t.tabId !== undefined).map((t) => t.tabId);
|
|
46
|
+
if (tabIds.length === targetIds.length) break;
|
|
47
|
+
await new Promise((r) => setTimeout(r, 100));
|
|
48
|
+
}
|
|
49
|
+
if (!tabIds.length) return null;
|
|
50
|
+
if (groupId !== null && groupId !== undefined) {
|
|
51
|
+
try {
|
|
52
|
+
await chrome.tabGroups.get(groupId);
|
|
53
|
+
return await chrome.tabs.group({ groupId, tabIds });
|
|
54
|
+
} catch {
|
|
55
|
+
// the user closed / ungrouped it - start a new group below
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const created = await chrome.tabs.group({ tabIds });
|
|
59
|
+
await chrome.tabGroups.update(created, { title, color, collapsed: false });
|
|
60
|
+
return created;
|
|
61
|
+
};
|
|
62
|
+
`;
|
|
63
|
+
|
|
64
|
+
/** Ghi (hoặc cập nhật) tệp tiện ích vào `dir`, trả `dir`. Không đổi thì không ghi lại. */
|
|
65
|
+
export function ensureTabGroupsExtension(dir = TAB_GROUPS_EXTENSION_DIR) {
|
|
66
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
67
|
+
const files = { 'manifest.json': `${JSON.stringify(MANIFEST, null, 2)}\n`, [TAB_GROUPS_SW_FILE]: SW_SOURCE };
|
|
68
|
+
for (const [name, content] of Object.entries(files)) {
|
|
69
|
+
const full = path.join(dir, name);
|
|
70
|
+
let current = null;
|
|
71
|
+
try { current = fs.readFileSync(full, 'utf8'); } catch { /* chưa có */ }
|
|
72
|
+
if (current !== content) fs.writeFileSync(full, content);
|
|
73
|
+
}
|
|
74
|
+
return dir;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** Tên nhóm: gọn một dòng, tối đa `max` ký tự. */
|
|
78
|
+
export function groupTitle(label, max = 28) {
|
|
79
|
+
const s = String(label || '').replace(/\s+/g, ' ').trim();
|
|
80
|
+
if (!s) return 'Aivin';
|
|
81
|
+
return s.length > max ? `${s.slice(0, max - 1).trimEnd()}…` : s;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Bộ gom nhóm cho MỘT trình duyệt (`wsUrl` cấp trình duyệt của cửa sổ Aivin). `add(targetId, { key, title })` đưa tab vào nhóm của `key` (đường hầm);
|
|
86
|
+
* không bao giờ ném lỗi — gom nhóm chỉ là tiện ích hiển thị. Nạp tiện ích không được → tắt hẳn cho trình duyệt này, gọi `onUnavailable` một lần.
|
|
87
|
+
*/
|
|
88
|
+
export function createTabGrouper({ wsUrl, extensionDir, WebSocketImpl = WSClient, onUnavailable = () => {} }) {
|
|
89
|
+
let ws = null;
|
|
90
|
+
let connecting = null;
|
|
91
|
+
let worker = null; // sessionId của phiên gắn vào service worker
|
|
92
|
+
let disabled = false;
|
|
93
|
+
let closed = false;
|
|
94
|
+
let nextId = 1;
|
|
95
|
+
let colorIndex = 0;
|
|
96
|
+
const pending = new Map();
|
|
97
|
+
const groups = new Map(); // key → { groupId, color }
|
|
98
|
+
const queues = new Map(); // key → Promise — các tab của cùng một nhóm gom lần lượt (không tạo hai nhóm)
|
|
99
|
+
|
|
100
|
+
const call = (method, params = {}, sessionId) => new Promise((resolve, reject) => {
|
|
101
|
+
if (!ws || ws.readyState !== WebSocketImpl.OPEN) { reject(new Error('Browser connection closed')); return; }
|
|
102
|
+
const id = nextId++;
|
|
103
|
+
const timer = setTimeout(() => { pending.delete(id); reject(new Error(`${method} timed out`)); }, CALL_TIMEOUT_MS);
|
|
104
|
+
pending.set(id, { resolve, reject, timer });
|
|
105
|
+
ws.send(JSON.stringify({ id, method, params, ...(sessionId ? { sessionId } : {}) }));
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
const connect = () => {
|
|
109
|
+
if (ws && ws.readyState === WebSocketImpl.OPEN) return Promise.resolve();
|
|
110
|
+
if (connecting) return connecting;
|
|
111
|
+
connecting = new Promise((resolve, reject) => {
|
|
112
|
+
const sock = new WebSocketImpl(wsUrl, { perMessageDeflate: false });
|
|
113
|
+
sock.once('open', () => { ws = sock; connecting = null; resolve(); });
|
|
114
|
+
sock.once('error', (e) => { connecting = null; reject(e); });
|
|
115
|
+
sock.on('message', (data) => {
|
|
116
|
+
let msg;
|
|
117
|
+
try { msg = JSON.parse(String(data)); } catch { return; }
|
|
118
|
+
const p = msg.id !== undefined ? pending.get(msg.id) : null;
|
|
119
|
+
if (!p) return;
|
|
120
|
+
pending.delete(msg.id);
|
|
121
|
+
clearTimeout(p.timer);
|
|
122
|
+
if (msg.error) p.reject(new Error(msg.error.message || 'CDP error'));
|
|
123
|
+
else p.resolve(msg.result || {});
|
|
124
|
+
});
|
|
125
|
+
sock.on('close', () => {
|
|
126
|
+
if (ws === sock) { ws = null; worker = null; }
|
|
127
|
+
for (const p of pending.values()) { clearTimeout(p.timer); p.reject(new Error('Browser connection closed')); }
|
|
128
|
+
pending.clear();
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
return connecting;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
const findWorker = async () => {
|
|
135
|
+
const { targetInfos = [] } = await call('Target.getTargets');
|
|
136
|
+
return targetInfos.find((t) => t.type === 'service_worker' && /^(chrome|edge)-extension:\/\//.test(t.url || '') && t.url.endsWith(`/${TAB_GROUPS_SW_FILE}`));
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
/** Gắn vào service worker của tiện ích; chưa nạp (hoặc `reload` — bản cũ thiếu hàm) thì nạp. Không được → ném lỗi. */
|
|
140
|
+
const attachWorker = async ({ reload = false } = {}) => {
|
|
141
|
+
await connect();
|
|
142
|
+
let sw = reload ? null : await findWorker();
|
|
143
|
+
if (!sw) {
|
|
144
|
+
await call('Extensions.loadUnpacked', { path: extensionDir || ensureTabGroupsExtension() });
|
|
145
|
+
for (let i = 0; i < 30 && !sw; i++) {
|
|
146
|
+
await new Promise((r) => setTimeout(r, 100));
|
|
147
|
+
sw = await findWorker();
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (!sw) throw new Error('The tab groups extension did not start');
|
|
151
|
+
const { sessionId } = await call('Target.attachToTarget', { targetId: sw.targetId, flatten: true });
|
|
152
|
+
await call('Runtime.runIfWaitingForDebugger', {}, sessionId).catch(() => undefined);
|
|
153
|
+
worker = sessionId;
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
const groupNow = async (targetId, key, title) => {
|
|
157
|
+
let entry = groups.get(key);
|
|
158
|
+
if (!entry) {
|
|
159
|
+
entry = { groupId: null, color: GROUP_COLORS[colorIndex++ % GROUP_COLORS.length] };
|
|
160
|
+
groups.set(key, entry);
|
|
161
|
+
}
|
|
162
|
+
for (let attempt = 0; attempt < 2; attempt++) {
|
|
163
|
+
if (!worker) {
|
|
164
|
+
try {
|
|
165
|
+
await attachWorker({ reload: attempt > 0 });
|
|
166
|
+
} catch (e) {
|
|
167
|
+
disabled = true;
|
|
168
|
+
onUnavailable(e);
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
let res;
|
|
173
|
+
try {
|
|
174
|
+
const args = { targetIds: [targetId], groupId: entry.groupId, title, color: entry.color };
|
|
175
|
+
res = await call('Runtime.evaluate', { expression: `self.aivinGroup(${JSON.stringify(args)})`, awaitPromise: true, returnByValue: true }, worker);
|
|
176
|
+
} catch {
|
|
177
|
+
worker = null; // service worker đã dừng / phiên rớt — gắn lại một lần
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
180
|
+
if (res.exceptionDetails) {
|
|
181
|
+
// Bản tiện ích cũ hơn (không có aivinGroup) → nạp lại; lỗi khác (tab vừa đóng…) thì thôi.
|
|
182
|
+
if (/aivinGroup/.test(JSON.stringify(res.exceptionDetails))) { worker = null; continue; }
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
if (typeof res.result?.value === 'number') entry.groupId = res.result.value;
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
return {
|
|
191
|
+
add(targetId, { key = 'aivin', title = 'Aivin' } = {}) {
|
|
192
|
+
if (disabled || closed || !targetId) return Promise.resolve();
|
|
193
|
+
const prev = queues.get(key) || Promise.resolve();
|
|
194
|
+
const next = prev.then(() => (disabled || closed ? undefined : groupNow(targetId, key, title))).catch(() => undefined);
|
|
195
|
+
queues.set(key, next);
|
|
196
|
+
return next;
|
|
197
|
+
},
|
|
198
|
+
/** Đường hầm đóng: quên nhóm của nó (nhóm trong trình duyệt vẫn còn tới khi người dùng đóng tab). */
|
|
199
|
+
forget(key) {
|
|
200
|
+
groups.delete(key);
|
|
201
|
+
queues.delete(key);
|
|
202
|
+
},
|
|
203
|
+
close() {
|
|
204
|
+
closed = true;
|
|
205
|
+
try { ws?.close(); } catch { /* đã đóng */ }
|
|
206
|
+
},
|
|
207
|
+
isDisabled: () => disabled,
|
|
208
|
+
};
|
|
209
|
+
}
|
|
@@ -16,9 +16,15 @@ import { buildGuiTools } from './gui/index.mjs';
|
|
|
16
16
|
import { buildOfficeTools } from './office/index.mjs';
|
|
17
17
|
import { measurePath } from './undoStore.mjs';
|
|
18
18
|
import { buildProcessTools, shellCommand } from './processes.mjs';
|
|
19
|
+
import { buildAgentTools, createAgentRunner } from './codingAgents.mjs';
|
|
20
|
+
|
|
21
|
+
/** Một bộ chạy agent lập trình cho cả tiến trình (việc đang chạy sống qua các lần dựng lại danh mục công cụ). */
|
|
22
|
+
let sharedAgents = null;
|
|
19
23
|
import { buildScheduleTools } from './schedule.mjs';
|
|
20
24
|
import { buildWatchTools } from './deviceWatches.mjs';
|
|
21
25
|
import { buildTransferTools } from './httpTransfer.mjs';
|
|
26
|
+
import { buildMeetingTools } from './meeting/index.mjs';
|
|
27
|
+
import { buildClipboardTools } from './clipboard.mjs';
|
|
22
28
|
|
|
23
29
|
/**
|
|
24
30
|
* Công cụ trên máy, chia gói theo năng lực phát hiện được (git chỉ có khi máy cài git, tìm nội dung dùng ripgrep nếu có…). Mỗi công cụ
|
|
@@ -710,12 +716,21 @@ export function buildTools(env) {
|
|
|
710
716
|
if (env.office?.apps?.length) tools.push(...buildOfficeTools(env.office.host, env.office.apps));
|
|
711
717
|
// Tiến trình nền + đọc log thời gian thực (dev server, build watch, claude -p, tail log).
|
|
712
718
|
if (env.processes) tools.push(...buildProcessTools(env.processes));
|
|
719
|
+
// Giao việc cho agent lập trình trên máy (Claude Code…, chế độ không giao diện, có phiên nói tiếp) — máy cá nhân có cài ít nhất một agent.
|
|
720
|
+
if (env.processes && env.schedules && !env.runAs) {
|
|
721
|
+
sharedAgents ||= env.codingAgents || createAgentRunner();
|
|
722
|
+
if (sharedAgents.installed().length) tools.push(...buildAgentTools(sharedAgents));
|
|
723
|
+
}
|
|
713
724
|
// Lịch chạy định kỳ (Task Scheduler / crontab) — máy cá nhân; máy tính tổ chức không đặt lịch cho thành viên.
|
|
714
725
|
if (env.schedules) tools.push(...buildScheduleTools(env.schedules));
|
|
715
726
|
// Tệp lớn hơn trần socket: HTTP thẳng với vé của BE (chỉ BE gọi).
|
|
716
727
|
if (env.transfer) tools.push(...buildTransferTools(env.transfer));
|
|
717
728
|
// Theo dõi trên máy kích hoạt việc của Aivin (tệp mới, dòng log) — BE đặt danh sách.
|
|
718
729
|
if (env.watches) tools.push(...buildWatchTools(env.watches));
|
|
730
|
+
// Ghi chú cuộc họp (ghi âm máy + micro, chuyển chữ sau khi họp) + chụp màn hình — Windows, máy cá nhân.
|
|
731
|
+
if (env.meetings || env.media) tools.push(...buildMeetingTools({ meetings: env.meetings, media: env.media }));
|
|
732
|
+
// Clipboard (chữ; Windows thêm ảnh + tệp đã copy) — máy cá nhân có màn hình.
|
|
733
|
+
if (env.clipboard) tools.push(...buildClipboardTools(env.clipboard));
|
|
719
734
|
// Máy tính tổ chức không lập chỉ mục tệp (nhiều người chung một máy) — Planner tìm bằng fs.list / fs.grep trong thư mục của mình.
|
|
720
735
|
return env.fileIndex ? tools : tools.filter((t) => t.name !== 'fs.find');
|
|
721
736
|
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# Aivin mascot
|
|
2
|
+
|
|
3
|
+
The Aivin mascot is the floating Windows interface for Aivin Remote. It shows what the agent is doing, accepts typed or spoken questions, and gives access to recent activity without opening the web app.
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
- Windows.
|
|
8
|
+
- A paired computer with the Aivin Remote listener running.
|
|
9
|
+
- The mascot enabled for that listener run.
|
|
10
|
+
|
|
11
|
+
Start the listener normally:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
aivin remote start
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
To show the mascot and open its ask box directly, run:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
aivin ui
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
If the listener is not running, `aivin ui` starts it in the background. If the computer has not been paired, the command prints pairing instructions instead.
|
|
24
|
+
|
|
25
|
+
## Using the mascot
|
|
26
|
+
|
|
27
|
+
- **Move it:** drag the mascot to another position. Aivin remembers the position for the next start.
|
|
28
|
+
- **Ask by typing:** hover over the mascot to reveal the ask box, or click it to open the box. Type a question and press Enter.
|
|
29
|
+
- **Talk to Aivin:** click the microphone button to start a live voice conversation. Click it again to finish; clicking while Aivin is speaking interrupts the reply.
|
|
30
|
+
- **Open activity:** right-click the mascot to show the detailed activity panel.
|
|
31
|
+
- **Start fresh:** choose **New chat session** in the activity panel. The previous conversation remains available in Aivin.
|
|
32
|
+
- **Attach local files:** drag files or folders onto the mascot. They are attached to the next question, subject to the attachment limit.
|
|
33
|
+
|
|
34
|
+
The app window that was active immediately before you opened the mascot or used its microphone hotkey is included as context. This lets questions such as “what is wrong here?” refer to that window. The agent only observes or captures the window when the request requires it.
|
|
35
|
+
|
|
36
|
+
## Status and motion
|
|
37
|
+
|
|
38
|
+
The mascot changes its expression and motion to reflect the listener state:
|
|
39
|
+
|
|
40
|
+
| State | Meaning |
|
|
41
|
+
| -------- | ---------------------------------------------------- |
|
|
42
|
+
| Idle | Connected and waiting for work |
|
|
43
|
+
| Working | A task or tool call is running |
|
|
44
|
+
| Thinking | Aivin is preparing a response |
|
|
45
|
+
| Waiting | Aivin needs an answer or confirmation |
|
|
46
|
+
| Done | The latest work completed successfully |
|
|
47
|
+
| Error | The latest work failed |
|
|
48
|
+
| Paused | Remote work is paused |
|
|
49
|
+
| Offline | The listener lost its connection and is reconnecting |
|
|
50
|
+
|
|
51
|
+
When turned off from the activity panel, the mascot fades and slides down before its window closes. This only closes the mascot interface; the Remote listener continues running in the background.
|
|
52
|
+
|
|
53
|
+
Preview all eight state animations without pairing or starting the listener:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
aivin ui --demo
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Keyboard shortcut
|
|
60
|
+
|
|
61
|
+
The default microphone shortcut is `Win+Alt+Space`. If another application already owns it, Aivin tries its fallback combinations.
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
aivin remote mascot hotkey # show the current shortcut
|
|
65
|
+
aivin remote mascot hotkey Ctrl+Alt+M # set a custom shortcut
|
|
66
|
+
aivin remote mascot hotkey off # disable the shortcut
|
|
67
|
+
aivin remote mascot hotkey default # restore automatic defaults
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Shortcut changes take effect after the mascot restarts.
|
|
71
|
+
|
|
72
|
+
## Turning the mascot on or off
|
|
73
|
+
|
|
74
|
+
Check or change the persistent setting:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
aivin remote mascot
|
|
78
|
+
aivin remote mascot off
|
|
79
|
+
aivin remote mascot on
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
The activity panel's **Turn mascot off** button also changes the persistent setting. Run `aivin ui` to enable and bring it back immediately. After using `aivin remote mascot on`, restart the listener for the setting to take effect.
|
|
83
|
+
|
|
84
|
+
To hide the mascot for only one listener run:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
aivin remote start --no-mascot
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Privacy and window behavior
|
|
91
|
+
|
|
92
|
+
- The mascot stays out of Aivin screenshots and screen sharing captures.
|
|
93
|
+
- It does not take keyboard focus unless its ask box is open.
|
|
94
|
+
- It moves out of the way while the agent controls another app window.
|
|
95
|
+
- Voice conversations appear as text in the ask box. Aivin ignores microphone input while its own voice is playing to avoid feedback.
|
|
96
|
+
- Interface text follows `AIVIN_LANG`, falling back to the Windows system language.
|
|
97
|
+
|
|
98
|
+
## Troubleshooting
|
|
99
|
+
|
|
100
|
+
**The mascot does not appear**
|
|
101
|
+
|
|
102
|
+
Run `aivin remote mascot` to check whether it is enabled, then run `aivin ui`. Use `aivin remote status` to confirm the listener is running.
|
|
103
|
+
|
|
104
|
+
**The microphone shortcut does not work**
|
|
105
|
+
|
|
106
|
+
Run `aivin remote mascot hotkey` to see the active candidates. Set another combination if they are already registered by other applications, then restart the mascot.
|
|
107
|
+
|
|
108
|
+
**The mascot says it is offline**
|
|
109
|
+
|
|
110
|
+
The listener is still running but cannot currently reach Aivin. Check the computer's connection and use `aivin remote logs` for details.
|
|
111
|
+
|
|
112
|
+
**The mascot is visible during a capture**
|
|
113
|
+
|
|
114
|
+
Normal Aivin captures exclude it. Set or remove any development-only capture overrides, then restart the listener.
|
|
115
|
+
|
|
116
|
+
See also the [Aivin Remote CLI reference](CLI.md#aivin-remote) for listener, meeting, update, and desktop-app commands.
|
package/docs/CLI.md
CHANGED
|
@@ -1062,12 +1062,15 @@ Runs an **AI Browser** mission - a multi-step, self-correcting agent that drives
|
|
|
1062
1062
|
Options:
|
|
1063
1063
|
--remote Use a server-side pooled browser instead of your own local one (no
|
|
1064
1064
|
local browser needed, no cookies/logins carried over)
|
|
1065
|
-
--debug-port <port> Local mode only: port to
|
|
1065
|
+
--debug-port <port> Local mode only: port to launch the AI Browser window's remote
|
|
1066
1066
|
debugging on (default: 9222, auto-tries a few nearby ports if that
|
|
1067
1067
|
one is taken by something else)
|
|
1068
|
-
--browser <edge|chrome>
|
|
1069
|
-
|
|
1070
|
-
|
|
1068
|
+
--browser <edge|chrome|brave|chromium>
|
|
1069
|
+
Local mode only: which browser to drive - default: auto-detects your
|
|
1070
|
+
OS's actual default browser, falling back to whichever of
|
|
1071
|
+
Edge/Chrome/Brave/Chromium is installed
|
|
1072
|
+
--separate-browser Local mode only: always use the dedicated AI Browser window, never
|
|
1073
|
+
your everyday browser
|
|
1071
1074
|
--url <url> Local mode only: open this URL before the mission starts, instead of a
|
|
1072
1075
|
blank page (auto-guessed for a few well-known sites mentioned by name
|
|
1073
1076
|
in the mission if omitted)
|
|
@@ -1081,12 +1084,34 @@ Options:
|
|
|
1081
1084
|
session is already active - no mission is started
|
|
1082
1085
|
```
|
|
1083
1086
|
|
|
1084
|
-
**Local mode (default)** - drives your own
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1087
|
+
**Local mode (default)** - drives a browser on your own computer via its remote-debugging protocol
|
|
1088
|
+
(CDP), through the same guarded tunnel `aivin remote` uses. Which browser, in order:
|
|
1089
|
+
|
|
1090
|
+
1. **Your everyday Chrome/Edge**, if you've switched on remote debugging in it yourself
|
|
1091
|
+
(`chrome://inspect/#remote-debugging`, or `edge://inspect/#remote-debugging`; Chrome 144+). The
|
|
1092
|
+
browser asks you to **Allow** the connection once. Every login you already have works. The AI
|
|
1093
|
+
opens its own tabs in the background, and your own tabs stay read-only to it. `--separate-browser`
|
|
1094
|
+
skips this step.
|
|
1095
|
+
2. **Otherwise, a dedicated AI Browser window**, on its own profile (`~/.aivin/browser-profile`),
|
|
1096
|
+
not your regular one. Cookies and logins persist there across runs. The first time you use a
|
|
1097
|
+
site, you log in once, same as in a fresh browser. The CLI opens this window itself, and
|
|
1098
|
+
reuses it while it's open. A Chrome/Edge window on any other profile is never attached to, even
|
|
1099
|
+
if it has a debug port open.
|
|
1100
|
+
|
|
1101
|
+
Either way, every command the server sends is filtered. No `file://` or browser-internal pages, no
|
|
1102
|
+
picking files from your disk, and no loading extensions. Downloads always go to `~/Downloads/Aivin`,
|
|
1103
|
+
and executables are cancelled as soon as they start downloading.
|
|
1104
|
+
|
|
1105
|
+
In the AI Browser window, the tabs a mission opens (and the popups they open) are put in one
|
|
1106
|
+
**tab group** named after the mission, with a different color per mission running at the same time.
|
|
1107
|
+
Tab groups have no CDP command, so the CLI loads a small extension of its own into that profile
|
|
1108
|
+
(`~/.aivin/browser-extension/tab-groups`, permissions `tabGroups` + `debugger`). The server can't
|
|
1109
|
+
reach it. A window opened by an older CLI version doesn't have this - close it and rerun. Your
|
|
1110
|
+
everyday browser's tabs are not grouped, because the CLI never installs anything into your own
|
|
1111
|
+
profile.
|
|
1112
|
+
|
|
1113
|
+
If the AI Browser window can't be started, `aivin browser` prints the exact launch command for your
|
|
1114
|
+
OS/browser instead of failing silently:
|
|
1090
1115
|
|
|
1091
1116
|
```bash
|
|
1092
1117
|
aivin browser "Find the top 3 posts on Hacker News right now and summarize them"
|
|
@@ -1119,6 +1144,8 @@ aivin remote devices # your paired computers + online state
|
|
|
1119
1144
|
aivin remote pause | resume # local kill switch - refuses every remote call while paused
|
|
1120
1145
|
aivin remote unpair [deviceId] # revoke (token stops working immediately)
|
|
1121
1146
|
aivin remote memory list|search|add|forget|clear # on-device memory, plain YAML in ~/.aivin/memory/
|
|
1147
|
+
aivin remote meeting start "Weekly sales" --then "summarize and draft an email to my manager" # meeting notes (Windows)
|
|
1148
|
+
aivin remote meeting stop | status | list | show [id]
|
|
1122
1149
|
aivin remote status | test | logs | reindex | enable | disable | reset-id
|
|
1123
1150
|
```
|
|
1124
1151
|
|
|
@@ -1135,7 +1162,108 @@ aivin remote status | test | logs | reindex | enable | disable | reset-id
|
|
|
1135
1162
|
- **Stays up to date by itself**: the listener checks for a new release about every 6 hours (and right away when the Aivin server
|
|
1136
1163
|
asks for a newer minimum version). When started with the computer (`aivin remote enable`), it switches to the new release once the
|
|
1137
1164
|
computer has had no remote work for 10 minutes; in a window you started yourself it only tells you to restart. If the new release
|
|
1138
|
-
crashes 3 times before it has run for 10 minutes, the previous release is put back and the bad one is skipped
|
|
1165
|
+
crashes 3 times before it has run for 10 minutes, the previous release is put back and the bad one is skipped - by the auto-start
|
|
1166
|
+
script itself (Windows: the Aivin tray app, or the VBS script on older setups; macOS / Linux `~/.aivin/aivin-remote-run.sh`) when it crashes right at start, otherwise by aivin on the
|
|
1167
|
+
next start. Auto-start set up by an older aivin lacks the first part: run `aivin remote enable` again to get it. See `aivin update`.
|
|
1168
|
+
- The Aivin server can only *suggest* versions (a minimum version, the latest published one, releases on hold) - it can never choose
|
|
1169
|
+
where aivin downloads from or what it installs. If the download site reports an older release than the server knows about, aivin
|
|
1170
|
+
warns once that the site may be blocked; a release on hold (e.g. because several computers had to roll back from it) is not
|
|
1171
|
+
installed by the background updater (`aivin update --to` still can).
|
|
1172
|
+
- **Aivin mascot on screen** (Windows): while the listener runs, a small Aivin bot floats over your windows. Its speech bubble shows
|
|
1173
|
+
the main thing the agent is doing on this computer; drag it anywhere (the spot is remembered). Hover it to **ask Aivin**: a small
|
|
1174
|
+
box pops up above it (and slips away when the mouse leaves, unless you are typing, talking or waiting for an answer); click the
|
|
1175
|
+
bot or the box to type (Enter) - it becomes a real chat on Aivin (also listed in your chats on the web), with the progress and the
|
|
1176
|
+
answer shown in the box. The window you were using right before you reached for the bot (or pressed the mic hotkey) goes along
|
|
1177
|
+
with the question, so "what's wrong here?" or "fill this in" means that window: the agent can read it (`gui.observe`) or take a
|
|
1178
|
+
screenshot (`screen.capture`); it only looks when the question needs it. Or click the mic to **talk with Aivin live**, like the mic on the web: it listens all the time, answers
|
|
1179
|
+
out loud and both sides show up as text in the box; click the mic while it talks to interrupt, while it listens to end. Its voice
|
|
1180
|
+
is not picked up by the mic (your words are ignored while it talks), so interrupt with the button. Right-click it for the detailed activity log and a "Pause AI" button (the same kill switch
|
|
1181
|
+
as `aivin remote pause`). The activity panel also has **Turn mascot off**: the mascot fades and slides away before its window closes,
|
|
1182
|
+
while the listener keeps running in the background. Run `aivin ui` to bring it back immediately, or use `aivin remote mascot on` and
|
|
1183
|
+
restart the listener. Apart from the open ask box it never takes keyboard focus; it is left out of screenshots and screen sharing,
|
|
1184
|
+
and steps aside while the agent controls an app window. `aivin remote mascot off` turns it off persistently; `aivin remote start --no-mascot`
|
|
1185
|
+
hides it for one run. Texts follow `AIVIN_LANG` / the system language. See the dedicated [Aivin mascot guide](AIVIN_MASCOT.md)
|
|
1186
|
+
for interaction, state, shortcut, privacy and troubleshooting details.
|
|
1187
|
+
- **Meeting notes** (Windows): ask the mascot something like "take notes of this meeting, then send my manager a summary". You can also
|
|
1188
|
+
run `aivin remote meeting start "<title>" --then "..."` yourself.
|
|
1189
|
+
- **What's recorded:** the computer's own sound (what the others say) and your microphone, plus a screenshot whenever the screen
|
|
1190
|
+
changes (shared slides). This works with any meeting app (Google Meet, Zoom, Teams, Zalo...), and nobody joins the meeting on
|
|
1191
|
+
your behalf.
|
|
1192
|
+
- **Approval:** the agent can't start a recording on its own. Starting one always needs a click on **Allow** on this computer, and
|
|
1193
|
+
you get a notification while it runs. Tell the other participants that they are being recorded.
|
|
1194
|
+
- **When it stops:** when the meeting window closes and the computer goes quiet, after 10 minutes of silence, after 3 hours, on
|
|
1195
|
+
`aivin remote meeting stop`, or when you press Pause.
|
|
1196
|
+
- **The transcript:** it is made only after the meeting is over, by sending ~30 s pieces through Aivin's voice-to-text.
|
|
1197
|
+
Then the audio files are deleted. If you gave an instruction ("then"), a new chat turn starts by itself with it. The
|
|
1198
|
+
agent reads the transcript with `meeting.transcript`, writes the summary and drafts the email. Sending still asks you on this
|
|
1199
|
+
computer first.
|
|
1200
|
+
- **Where it's stored:** `~/.aivin/meetings/<id>/`, which the file tools can't read. If you name a `save_dir` in the allowed area,
|
|
1201
|
+
it's stored there instead, so the files can be attached to an email.
|
|
1202
|
+
- **Restarts:** if the listener restarts mid-meeting, the transcript is finished on the next start, and background updates wait
|
|
1203
|
+
until the meeting is done. `--no-meetings` (or `AIVIN_REMOTE_MEETINGS=0`) turns it off.
|
|
1204
|
+
- **Speaker labels:** each line of the transcript is labelled **Me** (your microphone) or **Others** (the computer's sound). Pieces
|
|
1205
|
+
are cut where the talking switches between the two. The other participants are not told apart from each other.
|
|
1206
|
+
- **Screenshots on request:** the agent can also take a screenshot of the whole screen (`screen.capture`). The mascot is never in it.
|
|
1207
|
+
- **Clipboard**: the agent can read what you copied (`clipboard.read`) and put text on the clipboard for you to paste
|
|
1208
|
+
(`clipboard.write`). On Windows it can also read images and files copied in Explorer; on macOS (`pbpaste`) and Linux (`wl-paste`,
|
|
1209
|
+
`xclip` or `xsel`) only text. Anything a password manager marks private when copying (KeePass, 1Password, Bitwarden…) is never
|
|
1210
|
+
read. Windows' own clipboard history skips the same content.
|
|
1211
|
+
|
|
1212
|
+
## `aivin ui`
|
|
1213
|
+
|
|
1214
|
+
Shows the Aivin mascot with its ask box open, ready to type (Windows). If the listener (`aivin remote start`) is not running it is
|
|
1215
|
+
started in the background - through the Aivin tray app when it is installed (`aivin desktop install`), else the older "Aivin Remote"
|
|
1216
|
+
scheduled task, otherwise as a detached process. A computer that is not connected yet gets the pairing instructions.
|
|
1217
|
+
|
|
1218
|
+
Preview all eight mascot animations locally without pairing or starting the listener:
|
|
1219
|
+
|
|
1220
|
+
```bash
|
|
1221
|
+
aivin ui --demo
|
|
1222
|
+
```
|
|
1223
|
+
|
|
1224
|
+
Recording of the demo (idle, working, thinking, waiting, done, error, paused, offline): [media/aivin-mascot-states.mp4](media/aivin-mascot-states.mp4)
|
|
1225
|
+
|
|
1226
|
+
## `aivin desktop`
|
|
1227
|
+
|
|
1228
|
+
Puts Aivin on the desktop like a regular app: an icon you can click, an entry the system search finds, and a start-with-the-computer
|
|
1229
|
+
setting you can change in the system's own settings. The installers (`install.ps1`, `install.sh`) run `aivin desktop install` for you
|
|
1230
|
+
(on Linux only when there is a graphical session; `AIVIN_NO_DESKTOP=1` skips it, `AIVIN_NO_AUTOSTART=1` installs without starting with
|
|
1231
|
+
the computer).
|
|
1232
|
+
|
|
1233
|
+
```bash
|
|
1234
|
+
aivin desktop install # app + search entry + start with the computer (on by default)
|
|
1235
|
+
aivin desktop install --no-autostart # same, without starting with the computer
|
|
1236
|
+
aivin desktop uninstall # closes the app (and the listener it runs), removes all of it - `aivin` itself stays
|
|
1237
|
+
aivin desktop # status
|
|
1238
|
+
```
|
|
1239
|
+
|
|
1240
|
+
| | Windows | macOS | Linux |
|
|
1241
|
+
|---|---|---|---|
|
|
1242
|
+
| Icon | system tray (`%LOCALAPPDATA%\Aivin\Aivin.exe`) | menu bar (`~/Applications/Aivin.app`) | system tray (needs python3 + AppIndicator) |
|
|
1243
|
+
| Found by | Start menu | Spotlight / Launchpad | app menu (`~/.local/share/applications/aivin.desktop`) |
|
|
1244
|
+
| Start with the computer | Task Manager → Startup apps | System Settings → General → Login Items | Startup Applications (GNOME) / Autostart (KDE) |
|
|
1245
|
+
|
|
1246
|
+
- **The icon** is in colour while Aivin is taking work, grey when paused, stopped or not connected. Its menu: connect this computer
|
|
1247
|
+
(asks for the code from Aivin), pause / resume work (the kill switch), start with the computer, open the `~/.aivin` folder, quit
|
|
1248
|
+
(which also stops the listener). On Windows, clicking the icon opens the mascot and its ask box.
|
|
1249
|
+
- **Keeps the listener running**: the app runs `aivin remote start --quiet` hidden. It restarts it when it crashes (after 10 s, then
|
|
1250
|
+
longer, up to 5 minutes), switches to a newly installed release right away (exit code 75), and puts the previous release back when a
|
|
1251
|
+
new one keeps crashing at start. If you run `aivin remote start` yourself in a terminal, the app leaves it alone and takes over again
|
|
1252
|
+
once you close that window. Opening Aivin from the search again while it runs just opens it.
|
|
1253
|
+
- **Start with the computer** is one setting, whichever way you change it: the app's menu, `aivin remote enable` / `disable`, or the
|
|
1254
|
+
system settings in the table. `aivin remote disable` only switches it off, so it stays listed and can be switched back on there.
|
|
1255
|
+
- Windows: an `Aivin` value under `HKCU\Software\Microsoft\Windows\CurrentVersion\Run`, listed as "AIVIN Bot CLI" (publisher Aivin Labs); the Start menu entry has the same name.
|
|
1256
|
+
`Aivin.exe` is compiled on your computer by the C# compiler that comes with Windows (.NET Framework), so nothing is downloaded.
|
|
1257
|
+
If that compiler is blocked, `aivin remote enable` falls back to the "Aivin Remote" scheduled task (not shown in Task Manager).
|
|
1258
|
+
- macOS: the LaunchAgent `~/Library/LaunchAgents/com.aivin.remote.plist` opens `Aivin.app`, so Login Items lists it as "Aivin". If
|
|
1259
|
+
you switch it off in Login Items, Aivin's own menu may still show it as on (macOS does not let apps read that switch).
|
|
1260
|
+
- Linux: `~/.config/autostart/aivin.desktop` (switched off = `Hidden=true` / `X-GNOME-Autostart-enabled=false`). Without a graphical
|
|
1261
|
+
session (servers, SSH), `aivin remote enable` keeps using the systemd user service as before.
|
|
1262
|
+
- **Linux without a tray icon**: GNOME shows tray icons only with the AppIndicator extension (Ubuntu has it). Without python3's
|
|
1263
|
+
AppIndicator binding (`sudo apt install gir1.2-ayatanaappindicator3-0.1` on Ubuntu / Debian), Aivin still runs in the background,
|
|
1264
|
+
just without an icon - connect it with `aivin remote start --code <code>` once.
|
|
1265
|
+
- Running `aivin remote enable` again replaces the scheduled task, Startup-folder script or older LaunchAgent / autostart entry made by
|
|
1266
|
+
older aivin versions.
|
|
1139
1267
|
|
|
1140
1268
|
## `aivin update`
|
|
1141
1269
|
|
|
@@ -1154,6 +1282,9 @@ aivin update --auto off # stop background updates of `aivin remote start` o
|
|
|
1154
1282
|
```
|
|
1155
1283
|
|
|
1156
1284
|
- npm installs are not replaced; you get the `npm i -g @aivin-labs/cli@latest` command instead.
|
|
1285
|
+
- The build is streamed to disk while its SHA-256 is computed and it is unpacked, with size caps on both the download and the
|
|
1286
|
+
unpacked file - nothing large is held in memory, and an oversized or tampered download stops the update without touching the
|
|
1287
|
+
installed file.
|
|
1157
1288
|
- The download site comes only from this computer's environment, never from the Aivin server or a file: `AIVIN_DOWNLOAD_ROOT`
|
|
1158
1289
|
(e.g. an internal mirror - it does not need to be trusted, the signature still is checked), else `https://get.aivin.vn`. Only
|
|
1159
1290
|
`https` is accepted (plain `http` only to this computer itself), redirects included.
|
|
Binary file
|