@aivin-labs/cli 1.0.11 → 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.
Files changed (88) hide show
  1. package/README.md +325 -288
  2. package/bin/cli.mjs +163 -17
  3. package/bin/lib/localPreview.mjs +437 -0
  4. package/bin/lib/openFile.mjs +235 -0
  5. package/bin/lib/previewCache.mjs +71 -0
  6. package/bin/lib/remote/atomicFile.mjs +32 -0
  7. package/bin/lib/remote/autoStart.mjs +2 -1
  8. package/bin/lib/remote/autoUpdate.mjs +12 -0
  9. package/bin/lib/remote/browserTunnel.mjs +47 -8
  10. package/bin/lib/remote/callLedger.mjs +94 -14
  11. package/bin/lib/remote/cdpPolicy.mjs +14 -2
  12. package/bin/lib/remote/client.mjs +1024 -808
  13. package/bin/lib/remote/cloudFiles.mjs +53 -0
  14. package/bin/lib/remote/codingAgents.mjs +2 -2
  15. package/bin/lib/remote/constants.mjs +261 -234
  16. package/bin/lib/remote/credentials.mjs +81 -4
  17. package/bin/lib/remote/daemonLock.mjs +57 -17
  18. package/bin/lib/remote/dailyBrowser.mjs +8 -2
  19. package/bin/lib/remote/desktop/castInput.mjs +98 -0
  20. package/bin/lib/remote/desktop/desktopCast.mjs +334 -0
  21. package/bin/lib/remote/desktop/desktopCastCaptureSource.mjs +598 -0
  22. package/bin/lib/remote/desktop/desktopCastSource.mjs +798 -0
  23. package/bin/lib/remote/desktop/desktopWebRtc.mjs +242 -0
  24. package/bin/lib/remote/desktop/fileAssociation.mjs +108 -0
  25. package/bin/lib/remote/desktop/index.mjs +58 -7
  26. package/bin/lib/remote/desktop/linux.mjs +1 -1
  27. package/bin/lib/remote/desktop/linuxTraySource.mjs +427 -427
  28. package/bin/lib/remote/desktop/mac.mjs +2 -2
  29. package/bin/lib/remote/desktop/macTraySource.mjs +293 -292
  30. package/bin/lib/remote/desktop/strings.mjs +28 -2
  31. package/bin/lib/remote/desktop/traySource.mjs +905 -527
  32. package/bin/lib/remote/desktop/webrtcRuntime.mjs +137 -0
  33. package/bin/lib/remote/desktop/webrtcWorker.mjs +181 -0
  34. package/bin/lib/remote/deviceProfile.mjs +1 -0
  35. package/bin/lib/remote/docText.mjs +85 -0
  36. package/bin/lib/remote/fileIndexer.mjs +773 -399
  37. package/bin/lib/remote/folderRules.mjs +143 -0
  38. package/bin/lib/remote/gitSafe.mjs +31 -0
  39. package/bin/lib/remote/gui/index.mjs +170 -19
  40. package/bin/lib/remote/gui/officeHostSource.mjs +635 -393
  41. package/bin/lib/remote/gui/windowsHost.mjs +12 -3
  42. package/bin/lib/remote/gui/windowsHostSource.mjs +461 -87
  43. package/bin/lib/remote/httpTransfer.mjs +64 -3
  44. package/bin/lib/remote/idempotency.mjs +49 -20
  45. package/bin/lib/remote/localPolicy.mjs +81 -9
  46. package/bin/lib/remote/mascot/ask.mjs +207 -42
  47. package/bin/lib/remote/mascot/askBlocksSource.mjs +286 -0
  48. package/bin/lib/remote/mascot/askHostSource.mjs +658 -512
  49. package/bin/lib/remote/mascot/blocks.mjs +201 -0
  50. package/bin/lib/remote/mascot/bot.mjs +54 -5
  51. package/bin/lib/remote/mascot/chartLayout.mjs +382 -0
  52. package/bin/lib/remote/mascot/diagramRender.mjs +154 -0
  53. package/bin/lib/remote/mascot/emojiSource.mjs +273 -0
  54. package/bin/lib/remote/mascot/fileChips.mjs +62 -0
  55. package/bin/lib/remote/mascot/hostSource.mjs +331 -52
  56. package/bin/lib/remote/mascot/hotkey.mjs +31 -7
  57. package/bin/lib/remote/mascot/images.mjs +111 -0
  58. package/bin/lib/remote/mascot/index.mjs +663 -493
  59. package/bin/lib/remote/mascot/lucideIcons.mjs +32 -0
  60. package/bin/lib/remote/mascot/mermaidBundle.mjs +28 -0
  61. package/bin/lib/remote/mascot/mood.mjs +57 -0
  62. package/bin/lib/remote/mascot/rigSource.mjs +648 -609
  63. package/bin/lib/remote/mascot/safeUrl.mjs +29 -0
  64. package/bin/lib/remote/mascot/strings.mjs +456 -375
  65. package/bin/lib/remote/mascot/ui.mjs +27 -7
  66. package/bin/lib/remote/multiUser.mjs +7 -2
  67. package/bin/lib/remote/notify.mjs +4 -1
  68. package/bin/lib/remote/office/index.mjs +12 -6
  69. package/bin/lib/remote/osSearch.mjs +107 -0
  70. package/bin/lib/remote/processes.mjs +5 -2
  71. package/bin/lib/remote/sandbox.mjs +26 -0
  72. package/bin/lib/remote/secretPaths.mjs +21 -0
  73. package/bin/lib/remote/sqliteDb.mjs +51 -0
  74. package/bin/lib/remote/tokenRotation.mjs +28 -0
  75. package/bin/lib/remote/toolHandlers.mjs +852 -741
  76. package/bin/lib/remote/watchBatcher.mjs +56 -0
  77. package/bin/lib/remoteControl.mjs +26 -26
  78. package/bin/lib/selfUpdate.mjs +12 -2
  79. package/bin/lib/update/binarySwap.mjs +15 -1
  80. package/bin/lib/update/state.mjs +10 -0
  81. package/docs/AIVIN_MASCOT.md +14 -0
  82. package/docs/CLI.md +1545 -1484
  83. package/docs/media/aivin-ecosystem.jpg +0 -0
  84. package/docs/media/aivin-mascot-live.gif +0 -0
  85. package/docs/media/aivin-mascot-live.png +0 -0
  86. package/docs/media/aivin-remote-architecture.svg +102 -0
  87. package/package.json +75 -71
  88. package/docs/media/aivin-mascot-states.mp4 +0 -0
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Nét mặt theo emoji trong câu trả lời của Aivin (02/11/2026): AI đáp "Mình xin lỗi 😔…" → linh vật cụp mắt cúi đầu, "Xong rồi 🎉" → nhảy
3
+ * mừng. Emoji do chính model chọn theo ngữ cảnh nên dùng được mọi ngôn ngữ, không tốn thêm lượt gọi AI, không dò từ khoá.
4
+ *
5
+ * Chỉ xét câu chốt (không xét chữ đang chạy). Bỏ emoji trong khối code / mã nội dòng và emoji đầu dòng khi câu trả lời là danh sách
6
+ * (≥ 2 dòng mở đầu bằng emoji, kiểu ✅ / 📌) — đó là dấu đầu dòng, không phải cảm xúc. Nhiều emoji có nghĩa → lấy cái cuối (giọng kết câu).
7
+ * Emoji không có trong bảng (✅, 📄…) không tính.
8
+ */
9
+
10
+ export const Mood = Object.freeze({
11
+ SAD: 'sad', CRY: 'cry', SHEEPISH: 'sheepish', HAPPY: 'happy', CELEBRATE: 'celebrate', SURPRISED: 'surprised', CURIOUS: 'curious',
12
+ });
13
+
14
+ /** Mood buồn / khóc / ngượng: không nhảy mừng "xong", về thẳng chờ việc sau cử chỉ. */
15
+ export const SUBDUED_MOODS = new Set([Mood.SAD, Mood.CRY, Mood.SHEEPISH]);
16
+
17
+ const MOOD_EMOJI = {
18
+ [Mood.SAD]: '😔😞😟🥺😥😓😿💔☹🙁😕😣😖',
19
+ [Mood.CRY]: '😭😢🥲',
20
+ [Mood.SHEEPISH]: '😅😬🙈🫣😳',
21
+ [Mood.HAPPY]: '😊😄😁😃😀🙂🤗😍🥰😘❤💖💙👍🙌👏☺😌',
22
+ [Mood.CELEBRATE]: '🎉🥳🎊✨🏆🚀💪',
23
+ [Mood.SURPRISED]: '😮😲😯🤯😱',
24
+ [Mood.CURIOUS]: '🤔🧐',
25
+ };
26
+ const MOOD_OF = new Map(Object.entries(MOOD_EMOJI).flatMap(([mood, list]) => [...list].map((e) => [e, mood])));
27
+
28
+ /** Lệnh `gesture` cho cửa sổ: cử chỉ của rig (rigSource.mjs Play) + nét mặt (bot.mjs BOT_FACES) giữ trong `sec` giây. */
29
+ export const MOOD_GESTURE = Object.freeze({
30
+ [Mood.SAD]: { g: 'sad', face: 'sad', sec: 2.4 },
31
+ [Mood.CRY]: { g: 'cry', face: 'cry', sec: 3.2 },
32
+ [Mood.SHEEPISH]: { g: 'sheepish', face: 'sheepish', sec: 1.6 },
33
+ [Mood.HAPPY]: { g: 'giggle', face: 'hello', sec: 1.4 },
34
+ [Mood.CELEBRATE]: { g: 'wave', face: 'star', sec: 2 },
35
+ [Mood.SURPRISED]: { g: 'startle', face: 'waiting', sec: 1 },
36
+ [Mood.CURIOUS]: { g: 'ack', face: 'curious', sec: 1.6 },
37
+ });
38
+
39
+ const EMOJI = /\p{Extended_Pictographic}(?:️|\p{Emoji_Modifier}|‍\p{Extended_Pictographic}️?)*/gu;
40
+ const LINE_START_EMOJI = /^\s*\p{Extended_Pictographic}/u;
41
+
42
+ /** Emoji chỉ cảm xúc trong `text` → Mood, không có → null. */
43
+ export function moodOf(text) {
44
+ if (typeof text !== 'string' || !text) return null;
45
+ const plain = text.replace(/```[\s\S]*?```/g, ' ').replace(/`[^`\n]*`/g, ' ');
46
+ const lines = plain.split('\n');
47
+ const isList = lines.filter((l) => LINE_START_EMOJI.test(l)).length >= 2;
48
+ let mood = null;
49
+ for (const line of lines) {
50
+ for (const m of line.matchAll(EMOJI)) {
51
+ if (isList && !line.slice(0, m.index).trim()) continue;
52
+ const found = MOOD_OF.get(String.fromCodePoint(m[0].codePointAt(0)));
53
+ if (found) mood = found;
54
+ }
55
+ }
56
+ return mood;
57
+ }