@aivin-labs/cli 1.0.68 → 1.0.75
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/agentEvidence.mjs +2 -1
- package/bin/lib/remote/agentPreview.mjs +151 -0
- package/bin/lib/remote/client.mjs +12 -5
- package/bin/lib/remote/codingAgents.mjs +953 -799
- package/bin/lib/remote/desktop/desktopCast.mjs +3 -1
- package/bin/lib/remote/desktop/desktopCastCaptureSource.mjs +23 -4
- package/bin/lib/remote/desktop/desktopCastSource.mjs +2 -0
- package/bin/lib/remote/desktop/desktopWebRtc.mjs +2 -3
- package/bin/lib/remote/localLlm.mjs +626 -576
- package/bin/lib/remote/localLlmLogin.mjs +219 -0
- package/bin/lib/remote/localLlmMembers.mjs +96 -0
- package/bin/lib/remote/mascot/ask.mjs +30 -9
- package/bin/lib/remote/mascot/askHostSource.mjs +22 -8
- package/bin/lib/remote/mascot/emojiSource.mjs +60 -3
- package/bin/lib/remote/mascot/hostSource.mjs +9 -3
- package/bin/lib/remote/mascot/index.mjs +4 -2
- package/bin/lib/remote/mascot/localOpen.mjs +79 -0
- package/bin/lib/remote/mascot/strings.mjs +8 -5
- package/bin/lib/remote/toolHandlers.mjs +26 -2
- package/package.json +1 -1
|
@@ -291,7 +291,9 @@ export function createDesktopCastManager({ dir = CAST_DIR, spawnImpl = spawn } =
|
|
|
291
291
|
} else if (msg.t === 'cursor_hidden') {
|
|
292
292
|
cursorHidden = msg.hidden === true;
|
|
293
293
|
} else if (msg.t === 'clipboard') {
|
|
294
|
-
|
|
294
|
+
// Ảnh / chụp màn hình: không kèm chữ, vẫn báo để người xem biết máy vừa copy.
|
|
295
|
+
const text = typeof msg.text === 'string' ? msg.text : '';
|
|
296
|
+
if (text || msg.changed === true) onClipboard?.(text ? { text } : {});
|
|
295
297
|
} else if (msg.t === 'secure_desktop') {
|
|
296
298
|
onSecureDesktop?.({ active: msg.active === true });
|
|
297
299
|
} else if (msg.t === 'capture') {
|
|
@@ -863,19 +863,36 @@ namespace AivinDesktopCast {
|
|
|
863
863
|
}
|
|
864
864
|
}
|
|
865
865
|
|
|
866
|
-
/**
|
|
866
|
+
/**
|
|
867
|
+
* Đồng bộ bộ nhớ tạm giữa máy từ xa và trình duyệt điều khiển. Mọi lần người dùng máy copy (kể cả ảnh, ảnh chụp màn hình) đều báo:
|
|
868
|
+
* người xem cần biết bên nào copy sau cùng để Ctrl + V dán đúng bên. Chữ thì gửi kèm nội dung.
|
|
869
|
+
*/
|
|
867
870
|
public static class ClipboardSync {
|
|
868
871
|
const uint CF_UNICODETEXT = 13;
|
|
869
872
|
const uint GMEM_MOVEABLE = 0x0002;
|
|
870
873
|
const int MAX_CHARS = 65536;
|
|
874
|
+
const long OWN_WRITE_TICKS = 1500 * TimeSpan.TicksPerMillisecond;
|
|
871
875
|
static readonly object syncGate = new object();
|
|
872
876
|
static uint lastSeq = 0;
|
|
873
877
|
static string lastText = "";
|
|
878
|
+
static long ownUntil = 0;
|
|
874
879
|
|
|
875
880
|
public static void Init() {
|
|
876
881
|
try { lastSeq = Native.GetClipboardSequenceNumber(); } catch { }
|
|
877
882
|
}
|
|
878
883
|
|
|
884
|
+
/** Lệnh dán của người xem sắp ghi clipboard: lần đổi đó không phải người dùng máy copy, không báo. */
|
|
885
|
+
public static void ExpectOwnWrite() {
|
|
886
|
+
lock (syncGate) { ownUntil = DateTime.UtcNow.Ticks + OWN_WRITE_TICKS; }
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
/** Đã ghi xong: nhận số thứ tự hiện tại là của mình. */
|
|
890
|
+
public static void OwnWriteDone() {
|
|
891
|
+
lock (syncGate) {
|
|
892
|
+
try { lastSeq = Native.GetClipboardSequenceNumber(); } catch { }
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
|
|
879
896
|
public static void Poll() {
|
|
880
897
|
uint seq;
|
|
881
898
|
try { seq = Native.GetClipboardSequenceNumber(); } catch { return; }
|
|
@@ -884,12 +901,14 @@ namespace AivinDesktopCast {
|
|
|
884
901
|
lock (syncGate) {
|
|
885
902
|
if (seq == lastSeq) return;
|
|
886
903
|
lastSeq = seq;
|
|
904
|
+
if (DateTime.UtcNow.Ticks < ownUntil) return;
|
|
887
905
|
text = ReadTextUnsafe();
|
|
888
|
-
if (string.IsNullOrEmpty(text) || text == lastText)
|
|
889
|
-
lastText = text;
|
|
906
|
+
if (string.IsNullOrEmpty(text) || text == lastText) text = null;
|
|
907
|
+
else lastText = text;
|
|
890
908
|
}
|
|
891
909
|
var msg = Out.Msg("clipboard");
|
|
892
|
-
msg["
|
|
910
|
+
msg["changed"] = true;
|
|
911
|
+
if (text != null) msg["text"] = text;
|
|
893
912
|
Out.Send(msg);
|
|
894
913
|
}
|
|
895
914
|
|
|
@@ -189,6 +189,7 @@ namespace AivinDesktopCast {
|
|
|
189
189
|
public static class CastPaste {
|
|
190
190
|
public static bool Run(Func<System.Windows.Forms.DataObject> build, bool notifyOnFail) {
|
|
191
191
|
bool ok = false;
|
|
192
|
+
ClipboardSync.ExpectOwnWrite();
|
|
192
193
|
var sta = new Thread(() => {
|
|
193
194
|
try {
|
|
194
195
|
System.Windows.Forms.Clipboard.SetDataObject(build(), true, 10, 100);
|
|
@@ -198,6 +199,7 @@ namespace AivinDesktopCast {
|
|
|
198
199
|
sta.SetApartmentState(ApartmentState.STA);
|
|
199
200
|
sta.Start();
|
|
200
201
|
bool done = sta.Join(3000) && ok;
|
|
202
|
+
if (done) ClipboardSync.OwnWriteDone();
|
|
201
203
|
if (done) PressPaste();
|
|
202
204
|
else if (notifyOnFail) Out.Send(Out.Msg("paste_failed"));
|
|
203
205
|
return done;
|
|
@@ -371,11 +371,10 @@ export function createDesktopWebRtc({ emitSignal = () => {}, emitStatus = () =>
|
|
|
371
371
|
}
|
|
372
372
|
}
|
|
373
373
|
|
|
374
|
-
/**
|
|
374
|
+
/** Máy từ xa vừa copy (chữ thì kèm nội dung) → báo trình duyệt người xem qua kênh điều khiển: Ctrl + V sau đó dán của máy. */
|
|
375
375
|
function pushClipboard(clip) {
|
|
376
376
|
const text = typeof clip?.text === 'string' ? clip.text : '';
|
|
377
|
-
|
|
378
|
-
const packet = JSON.stringify({ t: 'clipboard', text });
|
|
377
|
+
const packet = JSON.stringify(text ? { t: 'clipboard', text } : { t: 'clipboard' });
|
|
379
378
|
for (const peer of peers.values()) {
|
|
380
379
|
if (peer.inputChannel?.readyState !== 'open') continue;
|
|
381
380
|
try { peer.inputChannel.send(packet); } catch { /* kênh vừa đóng */ }
|