@aivin-labs/cli 1.0.65 → 1.0.68
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/lib/remote/agentContract.mjs +10 -1
- package/bin/lib/remote/agentEvidence.mjs +97 -2
- package/bin/lib/remote/client.mjs +14 -3
- package/bin/lib/remote/codingAgents.mjs +171 -8
- package/bin/lib/remote/desktop/agentOverlay.mjs +382 -0
- package/bin/lib/remote/desktop/desktopCastSource.mjs +56 -17
- package/bin/lib/remote/gui/index.mjs +52 -1
- package/bin/lib/remote/localLlm.mjs +576 -514
- package/bin/lib/remote/localLlmAccounts.mjs +57 -0
- package/bin/lib/remote/mascot/hostSource.mjs +1 -1
- package/bin/lib/tasks.mjs +391 -389
- package/package.json +1 -1
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// Dấu vân tay tài khoản của từng agent làm mô hình trên máy (17/11/2026) — BE tính hạn mức theo TÀI KHOẢN (hai máy cùng một tài khoản
|
|
2
|
+
// Claude Code / Codex dùng chung hạn mức; xem BE DeviceLocalQuotaHelper). Chỉ gửi băm (không gửi email / mã tài khoản), đọc từ tệp đăng nhập
|
|
3
|
+
// sẵn có của agent; đọc không được → bỏ agent đó (BE tính theo máy như trước).
|
|
4
|
+
//
|
|
5
|
+
// - Claude Code: `<CLAUDE_CONFIG_DIR | ~>/.claude.json` → `oauthAccount.accountUuid` (thiếu thì `emailAddress`).
|
|
6
|
+
// - Codex: `<CODEX_HOME | ~/.codex>/auth.json` → `tokens.account_id`.
|
|
7
|
+
// - Antigravity: không lộ tài khoản (kể cả qua ACP) → `installation_id` của bản cài (`~/.gemini/antigravity-cli` hoặc `~/.gemini/antigravity`).
|
|
8
|
+
import { createHash } from 'crypto';
|
|
9
|
+
import fs from 'fs';
|
|
10
|
+
import os from 'os';
|
|
11
|
+
import path from 'path';
|
|
12
|
+
|
|
13
|
+
const readJson = (file) => {
|
|
14
|
+
try { return JSON.parse(fs.readFileSync(file, 'utf8')); } catch { return null; }
|
|
15
|
+
};
|
|
16
|
+
const readText = (file) => {
|
|
17
|
+
try { return fs.readFileSync(file, 'utf8').trim(); } catch { return ''; }
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const ACCOUNT_READERS = Object.freeze({
|
|
21
|
+
claude: ({ env, home }) => {
|
|
22
|
+
const dirs = [env.CLAUDE_CONFIG_DIR, home].filter(Boolean);
|
|
23
|
+
for (const dir of dirs) {
|
|
24
|
+
const acct = readJson(path.join(dir, '.claude.json'))?.oauthAccount;
|
|
25
|
+
const id = acct?.accountUuid || acct?.emailAddress;
|
|
26
|
+
if (id) return String(id);
|
|
27
|
+
}
|
|
28
|
+
return null;
|
|
29
|
+
},
|
|
30
|
+
codex: ({ env, home }) => {
|
|
31
|
+
const id = readJson(path.join(env.CODEX_HOME || path.join(home, '.codex'), 'auth.json'))?.tokens?.account_id;
|
|
32
|
+
return id ? String(id) : null;
|
|
33
|
+
},
|
|
34
|
+
antigravity: ({ home }) => {
|
|
35
|
+
for (const sub of ['antigravity-cli', 'antigravity']) {
|
|
36
|
+
const id = readText(path.join(home, '.gemini', sub, 'installation_id'));
|
|
37
|
+
if (id) return `install:${id}`;
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
/** Băm ổn định, không đảo ngược được: 16 ký tự hex của sha256("aivin-local-llm:<agent>:<id>"). */
|
|
44
|
+
export function accountFingerprint(agent, id) {
|
|
45
|
+
return createHash('sha256').update(`aivin-local-llm:${agent}:${id}`).digest('hex').slice(0, 16);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** `{ claude: '<16 hex>', … }` cho các agent đọc được tài khoản; rỗng → undefined. */
|
|
49
|
+
export function localLlmAccounts(agents, { env = process.env, home = os.homedir(), readers = ACCOUNT_READERS } = {}) {
|
|
50
|
+
const out = {};
|
|
51
|
+
for (const agent of agents || []) {
|
|
52
|
+
let id = null;
|
|
53
|
+
try { id = readers[agent]?.({ env, home }) || null; } catch { id = null; }
|
|
54
|
+
if (id) out[agent] = accountFingerprint(agent, id);
|
|
55
|
+
}
|
|
56
|
+
return Object.keys(out).length ? out : undefined;
|
|
57
|
+
}
|
|
@@ -298,7 +298,7 @@ ${[0, 1, 2].map((i) => ` <Border x:Name="NotifyStep${i}" Tag="${i}" Backgro
|
|
|
298
298
|
<TextBlock x:Name="AskStatus" Visibility="Collapsed" FontSize="13" Foreground="${B.muted}" Margin="0,2,4,1" TextTrimming="CharacterEllipsis"/>
|
|
299
299
|
</StackPanel>
|
|
300
300
|
<!-- Dau x mo o goc phai tren: cat o hoi di ngay, ke ca khi Aivin dang cho tra loi (cau hoi van con, mo lai bang cach re vao bot). -->
|
|
301
|
-
<Button x:Name="AskClose" Visibility="Collapsed" Style="{StaticResource IconBtn}" Width="18" Height="18" Padding="0" Margin="0,
|
|
301
|
+
<Button x:Name="AskClose" Visibility="Collapsed" Style="{StaticResource IconBtn}" Width="18" Height="18" Padding="0" Margin="0,1,1,0" Opacity="0.3"
|
|
302
302
|
HorizontalAlignment="Right" VerticalAlignment="Top" Background="#E8FFFFFF" BorderThickness="0" Tag="#F2F3F5">
|
|
303
303
|
<Path Data="${ICON_CLOSE_X}" Stroke="${B.muted}" StrokeThickness="1.5" StrokeStartLineCap="Round" StrokeEndLineCap="Round"
|
|
304
304
|
Width="9" Height="9" Stretch="Uniform"/>
|