@aivin-labs/cli 1.0.13 → 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 (72) hide show
  1. package/README.md +325 -304
  2. package/bin/cli.mjs +97 -18
  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/callLedger.mjs +21 -0
  10. package/bin/lib/remote/cdpPolicy.mjs +14 -2
  11. package/bin/lib/remote/client.mjs +1024 -889
  12. package/bin/lib/remote/codingAgents.mjs +2 -2
  13. package/bin/lib/remote/constants.mjs +261 -251
  14. package/bin/lib/remote/credentials.mjs +81 -4
  15. package/bin/lib/remote/daemonLock.mjs +57 -17
  16. package/bin/lib/remote/desktop/castInput.mjs +98 -0
  17. package/bin/lib/remote/desktop/desktopCast.mjs +334 -198
  18. package/bin/lib/remote/desktop/desktopCastCaptureSource.mjs +598 -0
  19. package/bin/lib/remote/desktop/desktopCastSource.mjs +798 -514
  20. package/bin/lib/remote/desktop/desktopWebRtc.mjs +242 -95
  21. package/bin/lib/remote/desktop/fileAssociation.mjs +108 -0
  22. package/bin/lib/remote/desktop/index.mjs +21 -7
  23. package/bin/lib/remote/desktop/linuxTraySource.mjs +1 -8
  24. package/bin/lib/remote/desktop/macTraySource.mjs +0 -2
  25. package/bin/lib/remote/desktop/strings.mjs +28 -2
  26. package/bin/lib/remote/desktop/traySource.mjs +380 -16
  27. package/bin/lib/remote/desktop/webrtcRuntime.mjs +137 -0
  28. package/bin/lib/remote/desktop/webrtcWorker.mjs +181 -0
  29. package/bin/lib/remote/fileIndexer.mjs +30 -14
  30. package/bin/lib/remote/folderRules.mjs +3 -0
  31. package/bin/lib/remote/gitSafe.mjs +31 -0
  32. package/bin/lib/remote/gui/index.mjs +66 -24
  33. package/bin/lib/remote/gui/officeHostSource.mjs +635 -393
  34. package/bin/lib/remote/gui/windowsHost.mjs +3 -1
  35. package/bin/lib/remote/gui/windowsHostSource.mjs +291 -60
  36. package/bin/lib/remote/httpTransfer.mjs +64 -3
  37. package/bin/lib/remote/localPolicy.mjs +73 -7
  38. package/bin/lib/remote/mascot/ask.mjs +207 -42
  39. package/bin/lib/remote/mascot/askBlocksSource.mjs +286 -0
  40. package/bin/lib/remote/mascot/askHostSource.mjs +658 -530
  41. package/bin/lib/remote/mascot/blocks.mjs +201 -0
  42. package/bin/lib/remote/mascot/bot.mjs +26 -2
  43. package/bin/lib/remote/mascot/chartLayout.mjs +382 -0
  44. package/bin/lib/remote/mascot/diagramRender.mjs +154 -0
  45. package/bin/lib/remote/mascot/emojiSource.mjs +273 -0
  46. package/bin/lib/remote/mascot/fileChips.mjs +62 -0
  47. package/bin/lib/remote/mascot/hostSource.mjs +328 -49
  48. package/bin/lib/remote/mascot/hotkey.mjs +31 -7
  49. package/bin/lib/remote/mascot/images.mjs +111 -0
  50. package/bin/lib/remote/mascot/index.mjs +663 -493
  51. package/bin/lib/remote/mascot/lucideIcons.mjs +32 -0
  52. package/bin/lib/remote/mascot/mermaidBundle.mjs +28 -0
  53. package/bin/lib/remote/mascot/mood.mjs +57 -0
  54. package/bin/lib/remote/mascot/rigSource.mjs +643 -609
  55. package/bin/lib/remote/mascot/safeUrl.mjs +29 -0
  56. package/bin/lib/remote/mascot/strings.mjs +456 -375
  57. package/bin/lib/remote/mascot/ui.mjs +27 -7
  58. package/bin/lib/remote/multiUser.mjs +7 -2
  59. package/bin/lib/remote/notify.mjs +4 -1
  60. package/bin/lib/remote/office/index.mjs +12 -6
  61. package/bin/lib/remote/processes.mjs +5 -2
  62. package/bin/lib/remote/sandbox.mjs +26 -0
  63. package/bin/lib/remote/secretPaths.mjs +21 -0
  64. package/bin/lib/remote/tokenRotation.mjs +28 -0
  65. package/bin/lib/remote/toolHandlers.mjs +79 -15
  66. package/bin/lib/remote/watchBatcher.mjs +56 -0
  67. package/bin/lib/selfUpdate.mjs +12 -2
  68. package/bin/lib/update/binarySwap.mjs +15 -1
  69. package/bin/lib/update/state.mjs +10 -0
  70. package/docs/CLI.md +42 -1
  71. package/docs/media/aivin-ecosystem.jpg +0 -0
  72. package/package.json +7 -3
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Link cửa sổ linh vật được phép mở khi bấm (02/11/2026): chỉ `http(s)://` — url trong báo chủ động / câu hỏi đến từ BE, cửa sổ mở bằng
3
+ * `Process.Start` (file:, ms-settings:, .exe… sẽ chạy thẳng trên máy). Không hợp lệ → null (dòng vẫn hiện, chỉ không bấm được).
4
+ */
5
+ export function safeWebUrl(url) {
6
+ if (typeof url !== 'string' || !/^https?:\/\//i.test(url.trim())) return null;
7
+ try {
8
+ const u = new URL(url.trim());
9
+ return (u.protocol === 'http:' || u.protocol === 'https:') && u.hostname ? u.href : null;
10
+ } catch {
11
+ return null;
12
+ }
13
+ }
14
+
15
+ /**
16
+ * Link của nút trong câu trả lời: http(s), hoặc gọi / mail / tin nhắn do ứng dụng trên máy xử lý. Bỏ tham số `attach` của mailto (vài ứng dụng thư tự đính kèm tệp trên máy).
17
+ */
18
+ export function safeLinkUrl(url) {
19
+ const web = safeWebUrl(url);
20
+ if (web) return web;
21
+ if (typeof url !== 'string') return null;
22
+ const raw = url.trim();
23
+ if (/^(tel|sms):[+\d][\d\s().*#-]{0,40}$/i.test(raw)) return raw;
24
+ if (!/^mailto:[^\s?&]+(\?\S*)?$/i.test(raw)) return null;
25
+ const [head, query] = raw.split('?');
26
+ if (!query) return head;
27
+ const kept = query.split('&').filter((p) => !/^attach/i.test(p));
28
+ return kept.length ? `${head}?${kept.join('&')}` : head;
29
+ }