@aivin-labs/cli 1.0.47 → 1.0.51
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 +1 -1
- package/bin/cli.mjs +1 -1
- package/bin/lib/auth.mjs +1 -1
- package/bin/lib/context.mjs +3 -3
- package/bin/lib/openFile.mjs +3 -2
- package/bin/lib/remote/client.mjs +1418 -1221
- package/bin/lib/remote/confirmBarrier.mjs +45 -0
- package/bin/lib/remote/constants.mjs +3 -1
- package/bin/lib/remote/desktop/aivinIco.mjs +696 -0
- package/bin/lib/remote/desktop/castAuth.mjs +23 -9
- package/bin/lib/remote/desktop/castConsent.mjs +37 -6
- package/bin/lib/remote/desktop/castFileDrop.mjs +24 -0
- package/bin/lib/remote/desktop/castInput.mjs +63 -19
- package/bin/lib/remote/desktop/castTouchViewers.mjs +26 -0
- package/bin/lib/remote/desktop/desktopCast.mjs +25 -2
- package/bin/lib/remote/desktop/desktopCastSource.mjs +298 -101
- package/bin/lib/remote/desktop/index.mjs +5 -3
- package/bin/lib/remote/desktop/traySource.mjs +1385 -1343
- package/bin/lib/remote/desktop/webrtcWorker.mjs +3 -0
- package/bin/lib/remote/deviceProfile.mjs +2 -0
- package/bin/lib/remote/gui/index.mjs +485 -480
- package/bin/lib/remote/humanInput.mjs +117 -0
- package/bin/lib/remote/idempotency.mjs +19 -2
- package/bin/lib/remote/keepAwake.mjs +15 -9
- package/bin/lib/remote/localConfirm.mjs +26 -7
- package/bin/lib/remote/mascot/ask.mjs +23 -4
- package/bin/lib/remote/mascot/askHostSource.mjs +10 -4
- package/bin/lib/remote/processes.mjs +231 -230
- package/bin/lib/remote/scheduler.mjs +164 -124
- package/bin/lib/remote/toolHandlers.mjs +3 -2
- package/bin/lib/remote/winTree.mjs +29 -0
- package/bin/lib/servers.mjs +31 -1
- package/docs/CLI.md +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rào xác nhận (09/11/2026): khi có hộp "Cho phép / Từ chối" đang chờ trên máy, lời gọi CÓ TÁC DỤNG khác chưa được bắt đầu. Trước đây lời
|
|
3
|
+
* gọi rủi ro A đứng chờ người bấm còn lời gọi B cùng lô vẫn chạy — B (`gui.do` bấm "Cho phép", hay `shell.exec` chạy script UIAutomation)
|
|
4
|
+
* tự duyệt được A, vô hiệu cả sàn xác nhận tại máy. Lời gọi chỉ đọc vẫn chạy (không bấm / gõ được gì).
|
|
5
|
+
*
|
|
6
|
+
* `hold()` → hàm thả (gọi nhiều lần vô hại); `waitClear(signal)` → `true` khi không còn hộp nào, `false` khi bị huỷ lúc chờ.
|
|
7
|
+
*/
|
|
8
|
+
export function createConfirmBarrier() {
|
|
9
|
+
let pending = 0;
|
|
10
|
+
let waiters = [];
|
|
11
|
+
|
|
12
|
+
const wake = () => {
|
|
13
|
+
const list = waiters;
|
|
14
|
+
waiters = [];
|
|
15
|
+
list.forEach((fn) => fn());
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
hold() {
|
|
20
|
+
pending++;
|
|
21
|
+
let released = false;
|
|
22
|
+
return () => {
|
|
23
|
+
if (released) return;
|
|
24
|
+
released = true;
|
|
25
|
+
pending--;
|
|
26
|
+
if (pending === 0) wake();
|
|
27
|
+
};
|
|
28
|
+
},
|
|
29
|
+
pending: () => pending,
|
|
30
|
+
async waitClear(signal) {
|
|
31
|
+
while (pending > 0) {
|
|
32
|
+
if (signal?.aborted) return false;
|
|
33
|
+
await new Promise((resolve) => {
|
|
34
|
+
const done = () => {
|
|
35
|
+
signal?.removeEventListener('abort', done);
|
|
36
|
+
resolve();
|
|
37
|
+
};
|
|
38
|
+
waiters.push(done);
|
|
39
|
+
signal?.addEventListener('abort', done, { once: true });
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
return !signal?.aborted;
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
@@ -84,6 +84,8 @@ export const DeviceEvent = Object.freeze({
|
|
|
84
84
|
NOTIFY_ACK: 'device:notify_ack',
|
|
85
85
|
/** CLI → BE: câu hỏi còn ghim đã đóng chưa `{ items: [{ session_id, reply_id }] }` — ack `{ ok, closed: reply_id[] }`. */
|
|
86
86
|
QUESTIONS: 'device:questions',
|
|
87
|
+
/** BE → CLI (09/11/2026): câu hỏi ghim đã xử lý ở nơi khác (duyệt trên web / máy khác) `{ reply_ids }` → bỏ nút ngay. */
|
|
88
|
+
QUESTION_CLOSED: 'device:question_closed',
|
|
87
89
|
/** CLI → BE: dừng lượt chat đang chạy `{ request_id }` — lượt kết thúc bằng `error` mã `cancelled`. */
|
|
88
90
|
CHAT_CANCEL: 'device:chat_cancel',
|
|
89
91
|
WEBVIEW: 'device:webview',
|
|
@@ -109,7 +111,7 @@ export const DeviceEvent = Object.freeze({
|
|
|
109
111
|
|
|
110
112
|
/** Trạng thái phiên xem màn hình gửi BE (`device:desktop_cast_status`) — khớp BE `DesktopCastState`. */
|
|
111
113
|
export const CastState = Object.freeze({
|
|
112
|
-
READY: 'ready', CONNECTED: 'connected', DEGRADED: 'degraded', STOPPED: 'stopped', REFUSED: 'refused', INPUT_BLOCKED: 'input_blocked', AWAITING_CONSENT: 'awaiting_consent',
|
|
114
|
+
READY: 'ready', CONNECTED: 'connected', DEGRADED: 'degraded', STOPPED: 'stopped', REFUSED: 'refused', INPUT_BLOCKED: 'input_blocked', AWAITING_CONSENT: 'awaiting_consent', PASTE_FAILED: 'paste_failed', DROP_REFUSED: 'drop_refused',
|
|
113
115
|
});
|
|
114
116
|
|
|
115
117
|
/** Loại báo chủ động (`device:notify`). */
|