@aixnn/aixautots 0.6.3 → 0.6.4

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.
@@ -1,5 +1,5 @@
1
- import { LogConsole } from './chunk-FW23FLAF.js';
2
- import { cn, Button, Select } from './chunk-EVHTAXQG.js';
1
+ import { LogConsole } from './chunk-M4DO7SSZ.js';
2
+ import { cn, Button, Select } from './chunk-YFF7VLNT.js';
3
3
  import { useDevices, useScripts, useScriptRun } from './chunk-Q63FQ7B5.js';
4
4
  import { variablesToSchema, normalizeDevices, schemaToVariables } from './chunk-BUW45GM2.js';
5
5
  import { useClient } from './chunk-A5VNENHD.js';
@@ -0,0 +1,44 @@
1
+ import { useState, useRef, useEffect } from 'react';
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+
4
+ // src/ui/primitives/Popover.tsx
5
+ function Popover({
6
+ trigger,
7
+ children,
8
+ align = "end",
9
+ className
10
+ }) {
11
+ const [open, setOpen] = useState(false);
12
+ const ref = useRef(null);
13
+ useEffect(() => {
14
+ if (!open) return;
15
+ const onDown = (e) => {
16
+ if (ref.current && !ref.current.contains(e.target)) setOpen(false);
17
+ };
18
+ const onKey = (e) => {
19
+ if (e.key === "Escape") {
20
+ e.preventDefault();
21
+ e.stopPropagation();
22
+ setOpen(false);
23
+ }
24
+ };
25
+ document.addEventListener("mousedown", onDown);
26
+ document.addEventListener("keydown", onKey);
27
+ return () => {
28
+ document.removeEventListener("mousedown", onDown);
29
+ document.removeEventListener("keydown", onKey);
30
+ };
31
+ }, [open]);
32
+ return /* @__PURE__ */ jsxs("div", { className: "relative inline-block", ref, children: [
33
+ trigger({ open, toggle: () => setOpen((o) => !o) }),
34
+ open && /* @__PURE__ */ jsx(
35
+ "div",
36
+ {
37
+ className: `absolute z-50 mt-1 min-w-[260px] rounded-md border border-border bg-background shadow-lg p-3 ${align === "end" ? "right-0" : "left-0"} ${className ?? ""}`,
38
+ children: children(() => setOpen(false))
39
+ }
40
+ )
41
+ ] });
42
+ }
43
+
44
+ export { Popover };
@@ -1,4 +1,4 @@
1
- import { cn } from './chunk-EVHTAXQG.js';
1
+ import { cn } from './chunk-YFF7VLNT.js';
2
2
  import { useRef, useMemo, useEffect } from 'react';
3
3
  import { jsx, jsxs } from 'react/jsx-runtime';
4
4
 
@@ -1,10 +1,217 @@
1
1
  import { MirrorView, ControlBar } from './chunk-E7WMHM63.js';
2
2
  import { useMirror, useDevices } from './chunk-Q63FQ7B5.js';
3
+ import { Popover } from './chunk-H37NHOYU.js';
3
4
  import { useClient } from './chunk-A5VNENHD.js';
4
5
  import { useState, useRef, useEffect, useCallback, useMemo } from 'react';
5
- import { RotateCw, Minimize2, Maximize2, X } from 'lucide-react';
6
+ import { Check, Settings2, VolumeX, Volume2, RotateCw, Minimize2, Maximize2, X, Rocket, Loader2, Square, Video, Download } from 'lucide-react';
6
7
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
7
8
 
9
+ var button = "flex w-full items-center justify-center gap-2 rounded-md border border-border px-2 py-2 text-xs hover:bg-secondary disabled:opacity-40";
10
+ function MirrorActions({ deviceId, stream, ready, platform = "android" }) {
11
+ const client = useClient();
12
+ const [showApps, setShowApps] = useState(false);
13
+ const [apps, setApps] = useState([]);
14
+ const [query, setQuery] = useState("");
15
+ const [loading, setLoading] = useState(false);
16
+ const [launching, setLaunching] = useState(false);
17
+ const [message, setMessage] = useState("");
18
+ const generation = useRef(0);
19
+ const busy = useRef(false);
20
+ useEffect(() => {
21
+ generation.current++;
22
+ busy.current = false;
23
+ setShowApps(false);
24
+ setApps([]);
25
+ setQuery("");
26
+ setMessage("");
27
+ setLoading(false);
28
+ setLaunching(false);
29
+ return () => {
30
+ generation.current++;
31
+ };
32
+ }, [deviceId]);
33
+ const loadApps = async () => {
34
+ const version = generation.current;
35
+ setLoading(true);
36
+ setMessage("");
37
+ try {
38
+ const result = await client.devices.op(deviceId, { op: "app_list" });
39
+ if (generation.current === version) setApps(result);
40
+ } catch (e) {
41
+ if (generation.current === version) setMessage(`\u5E94\u7528\u5217\u8868\u52A0\u8F7D\u5931\u8D25\uFF1A${String(e)}`);
42
+ } finally {
43
+ if (generation.current === version) setLoading(false);
44
+ }
45
+ };
46
+ const launch = async (pkg) => {
47
+ if (busy.current || !pkg.trim()) return;
48
+ busy.current = true;
49
+ const version = generation.current;
50
+ setLaunching(true);
51
+ setMessage("\u6B63\u5728\u542F\u52A8\u5E94\u7528\u2026");
52
+ try {
53
+ const { run_id } = await client.fleet.start({
54
+ script: { name: "\u955C\u50CF\u542F\u52A8\u5E94\u7528", platform: platform === "ios" ? "iOS" : "Android", language: "ts", code: `await device.launchApp(${JSON.stringify(pkg.trim())});` },
55
+ device_ids: [deviceId]
56
+ });
57
+ const detail = await client.fleet.waitForRun(run_id);
58
+ if (generation.current !== version) return;
59
+ const row = detail.devices?.[0];
60
+ if (row?.status === "done") setMessage("\u5E94\u7528\u5DF2\u542F\u52A8");
61
+ else if (row && ["failed", "cancelled", "canceled"].includes(row.status)) throw new Error(row.last_error || "\u5E94\u7528\u542F\u52A8\u5931\u8D25");
62
+ else setMessage("\u542F\u52A8\u4EFB\u52A1\u4ECD\u5728\u6267\u884C\uFF0C\u53EF\u5728\u4EFB\u52A1\u9875\u67E5\u770B\u7ED3\u679C");
63
+ } catch (e) {
64
+ if (generation.current === version) setMessage(`\u542F\u52A8\u5931\u8D25\uFF1A${String(e)}`);
65
+ } finally {
66
+ if (generation.current === version) {
67
+ busy.current = false;
68
+ setLaunching(false);
69
+ }
70
+ }
71
+ };
72
+ const filtered = apps.filter((app) => `${app.label} ${app.package}`.toLowerCase().includes(query.toLowerCase()));
73
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
74
+ /* @__PURE__ */ jsxs("button", { type: "button", className: button, "aria-expanded": showApps, onClick: () => {
75
+ setShowApps(!showApps);
76
+ if (!showApps) void loadApps();
77
+ }, children: [
78
+ /* @__PURE__ */ jsx(Rocket, { className: "h-3.5 w-3.5" }),
79
+ "\u542F\u52A8\u5E94\u7528"
80
+ ] }),
81
+ showApps && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 rounded-md border border-border p-2", children: [
82
+ /* @__PURE__ */ jsxs("form", { onSubmit: (e) => {
83
+ e.preventDefault();
84
+ void launch(query);
85
+ }, className: "flex flex-col gap-2", children: [
86
+ /* @__PURE__ */ jsx("input", { "aria-label": "\u641C\u7D22\u5E94\u7528\u6216\u8F93\u5165\u5305\u540D", placeholder: "\u641C\u7D22\u5E94\u7528 / \u8F93\u5165\u5305\u540D", value: query, onChange: (e) => setQuery(e.target.value), className: "w-full rounded border border-border bg-secondary p-1.5 text-xs" }),
87
+ /* @__PURE__ */ jsx("button", { type: "submit", className: button, disabled: launching || !query.trim(), children: "\u6309\u5305\u540D\u542F\u52A8" })
88
+ ] }),
89
+ /* @__PURE__ */ jsx("button", { type: "button", className: "text-xs text-muted-foreground", disabled: loading, onClick: () => void loadApps(), children: loading ? "\u52A0\u8F7D\u5E94\u7528\u4E2D\u2026" : "\u5237\u65B0\u5E94\u7528\u5217\u8868" }),
90
+ /* @__PURE__ */ jsxs("div", { className: "max-h-48 overflow-y-auto", "aria-label": "\u5E94\u7528\u5217\u8868", children: [
91
+ filtered.map((app) => /* @__PURE__ */ jsxs("button", { type: "button", disabled: launching, onClick: () => void launch(app.package), title: app.package, className: "block w-full rounded p-1.5 text-left hover:bg-secondary disabled:opacity-40", children: [
92
+ /* @__PURE__ */ jsx("span", { className: "block truncate text-xs", children: app.label || app.package }),
93
+ /* @__PURE__ */ jsx("span", { className: "block truncate text-[10px] text-muted-foreground", children: app.package })
94
+ ] }, app.package)),
95
+ !loading && !filtered.length && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "\u6CA1\u6709\u5339\u914D\u5E94\u7528\uFF0C\u53EF\u8F93\u5165\u5B8C\u6574\u5305\u540D\u542F\u52A8" })
96
+ ] })
97
+ ] }),
98
+ message && /* @__PURE__ */ jsx("p", { role: "status", className: "break-words text-xs text-muted-foreground", children: message }),
99
+ /* @__PURE__ */ jsx(MirrorRecording, { deviceId, stream, ready }, deviceId)
100
+ ] });
101
+ }
102
+ function saveRecording(blob, deviceId) {
103
+ const url = URL.createObjectURL(blob);
104
+ const link = document.createElement("a");
105
+ link.href = url;
106
+ link.download = `mirror-${deviceId.replace(/[^a-zA-Z0-9_-]/g, "_")}-${Date.now()}.${blob.type.includes("mp4") ? "mp4" : "webm"}`;
107
+ document.body.appendChild(link);
108
+ link.click();
109
+ link.remove();
110
+ setTimeout(() => URL.revokeObjectURL(url), 6e4);
111
+ }
112
+ function MirrorRecording({ deviceId, stream, ready }) {
113
+ const recorder = useRef(null);
114
+ const startRef = useRef(() => {
115
+ });
116
+ const stopRef = useRef(() => {
117
+ });
118
+ const [recording, setRecording] = useState(false);
119
+ const [finishing, setFinishing] = useState(false);
120
+ const [seconds, setSeconds] = useState(0);
121
+ const [error, setError] = useState("");
122
+ const [result, setResult] = useState(null);
123
+ const supported = typeof MediaRecorder !== "undefined";
124
+ useEffect(() => {
125
+ let active = true;
126
+ setRecording(false);
127
+ setFinishing(false);
128
+ let timer;
129
+ const stop = () => {
130
+ const rec = recorder.current;
131
+ if (rec && rec.state !== "inactive") {
132
+ if (active) setFinishing(true);
133
+ rec.stop();
134
+ }
135
+ };
136
+ const start = () => {
137
+ if (!stream || recorder.current) return;
138
+ const tracks = stream.getVideoTracks().filter((t) => t.readyState === "live").map((t) => t.clone());
139
+ if (!tracks.length) {
140
+ setError("\u955C\u50CF\u89C6\u9891\u5C1A\u672A\u5C31\u7EEA");
141
+ return;
142
+ }
143
+ const source = new MediaStream(tracks);
144
+ try {
145
+ const mimeType = ["video/webm;codecs=vp9", "video/webm;codecs=vp8", "video/webm", "video/mp4"].find((t) => MediaRecorder.isTypeSupported(t));
146
+ const rec = mimeType ? new MediaRecorder(source, { mimeType }) : new MediaRecorder(source);
147
+ const chunks = [];
148
+ recorder.current = rec;
149
+ rec.ondataavailable = (e) => {
150
+ if (e.data.size) chunks.push(e.data);
151
+ };
152
+ rec.onerror = () => {
153
+ if (active) setError("\u5F55\u5236\u4E2D\u65AD\uFF0C\u5DF2\u4FDD\u5B58\u7684\u7247\u6BB5\u53EF\u4E0B\u8F7D");
154
+ stop();
155
+ };
156
+ rec.onstop = () => {
157
+ clearInterval(timer);
158
+ source.getTracks().forEach((t) => t.stop());
159
+ if (recorder.current === rec) recorder.current = null;
160
+ const blob = new Blob(chunks, { type: rec.mimeType || chunks[0]?.type || "video/webm" });
161
+ if (active) {
162
+ setRecording(false);
163
+ setFinishing(false);
164
+ if (blob.size) setResult(blob);
165
+ else setError("\u6CA1\u6709\u6536\u5230\u5F55\u5236\u6570\u636E\uFF0C\u8BF7\u91CD\u8BD5");
166
+ } else if (blob.size) saveRecording(blob, deviceId);
167
+ };
168
+ rec.start(1e3);
169
+ const startedAt = Date.now();
170
+ setSeconds(0);
171
+ setError("");
172
+ setResult(null);
173
+ setRecording(true);
174
+ timer = setInterval(() => {
175
+ if (active) setSeconds(Math.floor((Date.now() - startedAt) / 1e3));
176
+ }, 1e3);
177
+ } catch (e) {
178
+ source.getTracks().forEach((t) => t.stop());
179
+ recorder.current = null;
180
+ setError(`\u65E0\u6CD5\u5F00\u59CB\u5F55\u5236\uFF1A${String(e)}`);
181
+ }
182
+ };
183
+ startRef.current = start;
184
+ stopRef.current = stop;
185
+ stream?.addEventListener("removetrack", stop);
186
+ const ended = () => stop();
187
+ stream?.getVideoTracks().forEach((t) => t.addEventListener("ended", ended));
188
+ return () => {
189
+ active = false;
190
+ clearInterval(timer);
191
+ stop();
192
+ stream?.removeEventListener("removetrack", stop);
193
+ stream?.getVideoTracks().forEach((t) => t.removeEventListener("ended", ended));
194
+ };
195
+ }, [deviceId, stream]);
196
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
197
+ /* @__PURE__ */ jsxs("button", { type: "button", className: button, disabled: finishing || !recording && (!supported || !ready), onClick: () => recording ? stopRef.current() : startRef.current(), children: [
198
+ finishing ? /* @__PURE__ */ jsx(Loader2, { className: "h-3.5 w-3.5 animate-spin" }) : recording ? /* @__PURE__ */ jsx(Square, { className: "h-3.5 w-3.5 text-red-500" }) : /* @__PURE__ */ jsx(Video, { className: "h-3.5 w-3.5" }),
199
+ finishing ? "\u6B63\u5728\u4FDD\u5B58\u2026" : recording ? "\u505C\u6B62\u5F55\u5C4F" : "\u5F00\u59CB\u5F55\u5C4F"
200
+ ] }),
201
+ recording && /* @__PURE__ */ jsxs("span", { role: "status", className: "text-center text-xs text-red-500", children: [
202
+ "\u5F55\u5236\u4E2D ",
203
+ Math.floor(seconds / 60).toString().padStart(2, "0"),
204
+ ":",
205
+ (seconds % 60).toString().padStart(2, "0")
206
+ ] }),
207
+ result && /* @__PURE__ */ jsxs("button", { type: "button", className: button, onClick: () => saveRecording(result, deviceId), children: [
208
+ /* @__PURE__ */ jsx(Download, { className: "h-3.5 w-3.5" }),
209
+ "\u4E0B\u8F7D\u5F55\u5C4F"
210
+ ] }),
211
+ /* @__PURE__ */ jsx("p", { className: "text-[10px] text-muted-foreground", children: supported ? "\u5F55\u5236\u5F53\u524D\u955C\u50CF\u753B\u9762\uFF08\u65E0\u58F0\uFF09\uFF0C\u6E05\u6670\u5EA6\u968F\u753B\u8D28\u8BBE\u7F6E\u3002\u5F55\u5236\u4E2D\u5173\u95ED\u65F6\u81EA\u52A8\u4FDD\u5B58\u3002" : "\u5F53\u524D\u6D4F\u89C8\u5668\u4E0D\u652F\u6301\u5F55\u5C4F" }),
212
+ error && /* @__PURE__ */ jsx("p", { role: "alert", className: "text-xs text-destructive", children: error })
213
+ ] });
214
+ }
8
215
  var PHASES = {
9
216
  android: [
10
217
  [25, "\u6B63\u5728\u8FDE\u63A5\u8BBE\u5907\u2026"],
@@ -244,8 +451,8 @@ var AUTO_QUALITY_INTERVAL_MS = 8e3;
244
451
  var AUTO_QUALITY_MIN_SWITCH_INTERVAL_MS = 15e3;
245
452
  function MirrorSurface({ deviceId, platform = "android", onSize, videoAspect, shortcutBar, className }) {
246
453
  const { stream, error, sendInput, setQuality, session } = useMirror(deviceId);
247
- const [clipboardSync, setClipboardSync] = useState(false);
248
- const { error: clipboardError, conflict: clipboardConflict, resolveConflict } = useClipboardSync(deviceId, clipboardSync && !!stream);
454
+ const [pasteContent, setPasteContent] = useState("");
455
+ const { error: clipboardError, conflict: clipboardConflict, resolveConflict } = useClipboardSync(deviceId, !!stream);
249
456
  const [size, setSize] = useState(DEFAULT_SIZE);
250
457
  const [hasFrame, setHasFrame] = useState(false);
251
458
  useEffect(() => {
@@ -253,6 +460,7 @@ function MirrorSurface({ deviceId, platform = "android", onSize, videoAspect, sh
253
460
  setVolume(0);
254
461
  }, [deviceId, stream]);
255
462
  useEffect(() => {
463
+ setPasteContent("");
256
464
  setSize(DEFAULT_SIZE);
257
465
  onSize?.(DEFAULT_SIZE);
258
466
  }, [deviceId, onSize]);
@@ -337,7 +545,30 @@ function MirrorSurface({ deviceId, platform = "android", onSize, videoAspect, sh
337
545
  );
338
546
  return /* @__PURE__ */ jsxs("div", { className: `flex min-h-0 flex-col items-center gap-2 ${className ?? ""}`, children: [
339
547
  /* @__PURE__ */ jsxs("div", { className: "flex min-h-0 w-full flex-1 items-stretch justify-center gap-2", children: [
340
- shortcutBar,
548
+ /* @__PURE__ */ jsxs("aside", { "aria-label": "\u955C\u50CF\u547D\u4EE4\u680F", className: "flex w-40 shrink-0 flex-col gap-3 overflow-y-auto rounded-lg border border-border bg-background p-2 text-foreground", children: [
549
+ /* @__PURE__ */ jsx(MirrorActions, { deviceId, stream, ready: hasFrame, platform }),
550
+ shortcutBar,
551
+ /* @__PURE__ */ jsxs("form", { className: "flex flex-col gap-2", onSubmit: (e) => {
552
+ e.preventDefault();
553
+ if (stream && pasteContent.trim()) sendInput({ t: "text", value: pasteContent });
554
+ }, children: [
555
+ /* @__PURE__ */ jsxs("label", { className: "text-xs font-medium", children: [
556
+ "\u547D\u4EE4 / \u7C98\u8D34\u5185\u5BB9",
557
+ /* @__PURE__ */ jsx(
558
+ "textarea",
559
+ {
560
+ "aria-label": "\u547D\u4EE4 / \u7C98\u8D34\u5185\u5BB9",
561
+ value: pasteContent,
562
+ onChange: (e) => setPasteContent(e.target.value),
563
+ placeholder: "\u8F93\u5165\u6216\u7C98\u8D34\u5185\u5BB9",
564
+ rows: 5,
565
+ className: "mt-2 w-full resize-y rounded border border-border bg-secondary p-2 text-xs"
566
+ }
567
+ )
568
+ ] }),
569
+ /* @__PURE__ */ jsx("button", { type: "submit", disabled: !stream || !pasteContent.trim(), className: "rounded bg-primary px-2 py-2 text-xs text-primary-foreground disabled:opacity-40", children: "\u7C98\u8D34\u5230\u8BBE\u5907" })
570
+ ] })
571
+ ] }),
341
572
  /* @__PURE__ */ jsxs(
342
573
  "div",
343
574
  {
@@ -369,7 +600,7 @@ function MirrorSurface({ deviceId, platform = "android", onSize, videoAspect, sh
369
600
  }
370
601
  )
371
602
  ] }),
372
- /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-center gap-2", children: [
603
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-center gap-1 rounded-xl border border-border bg-background px-2 py-1 shadow-lg", children: [
373
604
  /* @__PURE__ */ jsx(
374
605
  ControlBar,
375
606
  {
@@ -379,18 +610,52 @@ function MirrorSurface({ deviceId, platform = "android", onSize, videoAspect, sh
379
610
  onMenu: () => sendInput({ t: "key", code: "app_switch" })
380
611
  }
381
612
  ),
382
- /* @__PURE__ */ jsx(
383
- "select",
613
+ /* @__PURE__ */ jsx(Popover, { className: "bottom-full mb-2 !mt-0 !min-w-[140px]", trigger: ({ open, toggle }) => /* @__PURE__ */ jsxs(
614
+ "button",
384
615
  {
616
+ type: "button",
385
617
  "aria-label": "\u753B\u8D28\u6863\u4F4D",
386
- value: profile,
387
- onChange: (e) => changeProfile(e.target.value, true),
388
- className: "rounded border border-border bg-secondary px-2 py-1 text-xs text-foreground outline-none hover:bg-card",
389
- children: Object.keys(PROFILE_LABELS).map((p) => /* @__PURE__ */ jsx("option", { value: p, children: PROFILE_LABELS[p] }, p))
618
+ "aria-expanded": open,
619
+ "aria-haspopup": "menu",
620
+ onClick: toggle,
621
+ className: "flex h-9 items-center gap-1.5 rounded-md px-2 text-xs text-foreground hover:bg-secondary",
622
+ title: "\u753B\u8D28\u6863\u4F4D",
623
+ children: [
624
+ /* @__PURE__ */ jsx(Settings2, { className: "h-4 w-4" }),
625
+ PROFILE_LABELS[profile]
626
+ ]
390
627
  }
391
- ),
392
- /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-1 text-xs text-foreground", children: [
393
- "\u97F3\u91CF",
628
+ ), children: (close) => /* @__PURE__ */ jsx("div", { role: "menu", "aria-label": "\u9009\u62E9\u753B\u8D28", children: Object.keys(PROFILE_LABELS).map((p) => /* @__PURE__ */ jsxs(
629
+ "button",
630
+ {
631
+ type: "button",
632
+ role: "menuitemradio",
633
+ "aria-checked": profile === p,
634
+ onClick: () => {
635
+ changeProfile(p, true);
636
+ close();
637
+ },
638
+ className: "flex w-full items-center justify-between gap-4 rounded px-2 py-2 text-xs text-foreground hover:bg-secondary",
639
+ children: [
640
+ PROFILE_LABELS[p],
641
+ profile === p && /* @__PURE__ */ jsx(Check, { className: "h-3.5 w-3.5" })
642
+ ]
643
+ },
644
+ p
645
+ )) }) }),
646
+ /* @__PURE__ */ jsx(Popover, { className: "bottom-full mb-2 !mt-0 !min-w-0", trigger: ({ open, toggle }) => /* @__PURE__ */ jsx(
647
+ "button",
648
+ {
649
+ type: "button",
650
+ "aria-label": "\u97F3\u91CF",
651
+ "aria-expanded": open,
652
+ "aria-haspopup": "dialog",
653
+ onClick: toggle,
654
+ title: `\u97F3\u91CF ${volume}%`,
655
+ className: "flex h-9 w-9 items-center justify-center rounded-md text-foreground hover:bg-secondary",
656
+ children: volume === 0 ? /* @__PURE__ */ jsx(VolumeX, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(Volume2, { className: "h-4 w-4" })
657
+ }
658
+ ), children: () => /* @__PURE__ */ jsxs("div", { role: "dialog", "aria-label": "\u97F3\u91CF\u8C03\u8282", className: "flex flex-col items-center gap-2", children: [
394
659
  /* @__PURE__ */ jsx(
395
660
  "input",
396
661
  {
@@ -399,22 +664,22 @@ function MirrorSurface({ deviceId, platform = "android", onSize, videoAspect, sh
399
664
  min: 0,
400
665
  max: 100,
401
666
  value: volume,
667
+ style: { writingMode: "vertical-lr", direction: "rtl", width: 24, height: 112 },
402
668
  disabled: !stream,
403
669
  onChange: (e) => {
404
670
  const next = Number(e.target.value);
405
671
  if (audioEnabledRef.current !== next > 0) sendInput({ t: "audio", enabled: next > 0 });
406
672
  audioEnabledRef.current = next > 0;
407
673
  setVolume(next);
408
- },
409
- className: "w-20"
674
+ }
410
675
  }
411
676
  ),
412
- /* @__PURE__ */ jsx("span", { children: volume > 0 && !hasAudio ? "\u7B49\u5F85\u97F3\u9891\u6D41" : `${volume}%` })
413
- ] }),
414
- /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-1 text-xs text-foreground", children: [
415
- /* @__PURE__ */ jsx("input", { type: "checkbox", checked: clipboardSync, onChange: (e) => setClipboardSync(e.target.checked) }),
416
- "\u53CC\u5411\u540C\u6B65\u526A\u8D34\u677F"
417
- ] }),
677
+ /* @__PURE__ */ jsxs("span", { className: "whitespace-nowrap text-xs text-foreground", children: [
678
+ volume,
679
+ "%"
680
+ ] }),
681
+ volume > 0 && !hasAudio && /* @__PURE__ */ jsx("span", { role: "status", className: "whitespace-nowrap text-xs text-muted-foreground", children: "\u7B49\u5F85\u97F3\u9891\u6D41" })
682
+ ] }) }),
418
683
  clipboardConflict && /* @__PURE__ */ jsxs(Fragment, { children: [
419
684
  /* @__PURE__ */ jsx("button", { type: "button", onClick: () => resolveConflict("local"), className: "text-xs underline", children: "\u4FDD\u7559\u672C\u673A\u526A\u8D34\u677F" }),
420
685
  /* @__PURE__ */ jsx("button", { type: "button", onClick: () => resolveConflict("device"), className: "text-xs underline", children: "\u4FDD\u7559\u8BBE\u5907\u526A\u8D34\u677F" })
@@ -423,7 +688,7 @@ function MirrorSurface({ deviceId, platform = "android", onSize, videoAspect, sh
423
688
  "\u526A\u8D34\u677F\u540C\u6B65\u5931\u8D25\uFF1A",
424
689
  clipboardError
425
690
  ] }),
426
- platform === "android" && /* @__PURE__ */ jsxs(
691
+ platform === "android" && /* @__PURE__ */ jsx(
427
692
  "button",
428
693
  {
429
694
  type: "button",
@@ -431,11 +696,8 @@ function MirrorSurface({ deviceId, platform = "android", onSize, videoAspect, sh
431
696
  "aria-label": landscape ? "\u5207\u56DE\u7AD6\u5C4F" : "\u5207\u6362\u6A2A\u5C4F",
432
697
  title: landscape ? "\u5207\u56DE\u7AD6\u5C4F" : "\u5207\u6362\u6A2A\u5C4F",
433
698
  "aria-pressed": landscape,
434
- className: `flex items-center gap-1 rounded border border-border px-2 py-1 text-xs outline-none hover:bg-card ${landscape ? "bg-primary/15 text-primary" : "bg-secondary text-foreground"}`,
435
- children: [
436
- /* @__PURE__ */ jsx(RotateCw, { className: "h-3.5 w-3.5" }),
437
- landscape ? "\u7AD6\u5C4F" : "\u6A2A\u5C4F"
438
- ]
699
+ className: `flex h-9 w-9 items-center justify-center rounded-md text-xs outline-none hover:bg-card ${landscape ? "bg-primary/15 text-primary" : "bg-secondary text-foreground"}`,
700
+ children: /* @__PURE__ */ jsx(RotateCw, { className: "h-3.5 w-3.5" })
439
701
  }
440
702
  )
441
703
  ] })
@@ -1,4 +1,4 @@
1
- import { cn, Select, Dialog, Button, Input, Badge } from './chunk-EVHTAXQG.js';
1
+ import { cn, Select, Dialog, Button, Input, Badge } from './chunk-YFF7VLNT.js';
2
2
  import { useNodes, useDevices } from './chunk-Q63FQ7B5.js';
3
3
  import { useClient } from './chunk-A5VNENHD.js';
4
4
  import { useMemo, useEffect, useState, useCallback } from 'react';
@@ -1,11 +1,12 @@
1
1
  import { useAixT } from './chunk-T3QVYTOT.js';
2
- import { LogConsole } from './chunk-FW23FLAF.js';
3
- import { MirrorSurface, DeviceMirror } from './chunk-VVJ4TK6D.js';
2
+ import { LogConsole } from './chunk-M4DO7SSZ.js';
3
+ import { MirrorSurface, DeviceMirror } from './chunk-NGW34POA.js';
4
4
  import { ControlBar, MirrorView } from './chunk-E7WMHM63.js';
5
- import { createProxyProbeGuard, proxySummaryFromDevice, isProxyApplyStatus, proxyCapabilityReason, proxyProbeExitIp, proxyProbeMessage, DeviceCreate, isProxyProbeUnsupported, isRedactedProxyUrl, isSupportedProxyUrl, redactProxyUrl } from './chunk-P2Y655SL.js';
6
- import { cn, Badge, Button, Dialog, Input, Popover, Select, useToast, ToastViewport, Drawer } from './chunk-EVHTAXQG.js';
5
+ import { createProxyProbeGuard, proxySummaryFromDevice, isProxyApplyStatus, proxyCapabilityReason, proxyProbeExitIp, proxyProbeMessage, DeviceCreate, isProxyProbeUnsupported, isRedactedProxyUrl, isSupportedProxyUrl, redactProxyUrl } from './chunk-SAB5CH2K.js';
6
+ import { cn, Badge, Button, Dialog, Input, Select, useToast, ToastViewport, Drawer } from './chunk-YFF7VLNT.js';
7
7
  import { useDevicesView, useShortcutsView, GROUP_MIRROR_MAX, useGroupMirror, useScripts, useFleetRun, useTaskAgentRun, preflightTaskAgentDevice, createAgentTaskRunner, useNodesView } from './chunk-Q63FQ7B5.js';
8
8
  import { DeviceSession, pushFile, pullFile } from './chunk-LAZ3RQ7X.js';
9
+ import { Popover } from './chunk-H37NHOYU.js';
9
10
  import { useClient } from './chunk-A5VNENHD.js';
10
11
  import { useState, useRef, useCallback, useEffect, useMemo, useLayoutEffect } from 'react';
11
12
  import * as Icons from 'lucide-react';
@@ -3,7 +3,7 @@ import { twMerge } from 'tailwind-merge';
3
3
  import * as DialogPrimitive from '@radix-ui/react-dialog';
4
4
  import { X, CheckCircle2, XCircle, Info, ChevronDown } from 'lucide-react';
5
5
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
6
- import { forwardRef, useState, useCallback, useEffect, useRef } from 'react';
6
+ import { forwardRef, useState, useCallback, useEffect } from 'react';
7
7
  import { cva } from 'class-variance-authority';
8
8
 
9
9
  // src/ui/primitives/utils.ts
@@ -235,39 +235,5 @@ var badgeVariants = cva(
235
235
  function Badge({ className, variant, ...props }) {
236
236
  return /* @__PURE__ */ jsx("span", { className: cn(badgeVariants({ variant, className })), ...props });
237
237
  }
238
- function Popover({
239
- trigger,
240
- children,
241
- align = "end",
242
- className
243
- }) {
244
- const [open, setOpen] = useState(false);
245
- const ref = useRef(null);
246
- useEffect(() => {
247
- if (!open) return;
248
- const onDown = (e) => {
249
- if (ref.current && !ref.current.contains(e.target)) setOpen(false);
250
- };
251
- const onKey = (e) => {
252
- if (e.key === "Escape") setOpen(false);
253
- };
254
- document.addEventListener("mousedown", onDown);
255
- document.addEventListener("keydown", onKey);
256
- return () => {
257
- document.removeEventListener("mousedown", onDown);
258
- document.removeEventListener("keydown", onKey);
259
- };
260
- }, [open]);
261
- return /* @__PURE__ */ jsxs("div", { className: "relative inline-block", ref, children: [
262
- trigger({ open, toggle: () => setOpen((o) => !o) }),
263
- open && /* @__PURE__ */ jsx(
264
- "div",
265
- {
266
- className: `absolute z-50 mt-1 min-w-[260px] rounded-md border border-border bg-background shadow-lg p-3 ${align === "end" ? "right-0" : "left-0"} ${className ?? ""}`,
267
- children: children(() => setOpen(false))
268
- }
269
- )
270
- ] });
271
- }
272
238
 
273
- export { Badge, Button, Dialog, Drawer, Input, Popover, Select, ToastViewport, cn, useToast };
239
+ export { Badge, Button, Dialog, Drawer, Input, Select, ToastViewport, cn, useToast };
@@ -1,8 +1,9 @@
1
1
  import { useAixT } from '../chunk-T3QVYTOT.js';
2
- import { cn, Button, Badge, Input } from '../chunk-EVHTAXQG.js';
2
+ import { cn, Button, Badge, Input } from '../chunk-YFF7VLNT.js';
3
3
  import { useBilling } from '../chunk-Q63FQ7B5.js';
4
4
  import '../chunk-BUW45GM2.js';
5
5
  import '../chunk-LAZ3RQ7X.js';
6
+ import '../chunk-H37NHOYU.js';
6
7
  import { useClient } from '../chunk-A5VNENHD.js';
7
8
  import '../chunk-JTFZSFFA.js';
8
9
  import '../chunk-B2BOVLI6.js';
@@ -1,8 +1,9 @@
1
- export { AddWirelessDeviceDialog, DeviceCreate, NodePicker, ProxySpoofStep, RealDiscoverStep, VirtualSpecStep } from '../chunk-P2Y655SL.js';
2
- import '../chunk-EVHTAXQG.js';
1
+ export { AddWirelessDeviceDialog, DeviceCreate, NodePicker, ProxySpoofStep, RealDiscoverStep, VirtualSpecStep } from '../chunk-SAB5CH2K.js';
2
+ import '../chunk-YFF7VLNT.js';
3
3
  import '../chunk-Q63FQ7B5.js';
4
4
  import '../chunk-BUW45GM2.js';
5
5
  import '../chunk-LAZ3RQ7X.js';
6
+ import '../chunk-H37NHOYU.js';
6
7
  import '../chunk-A5VNENHD.js';
7
8
  import '../chunk-JTFZSFFA.js';
8
9
  import '../chunk-B2BOVLI6.js';
@@ -1,9 +1,10 @@
1
- export { DeviceBootSplash, DeviceMirror, MirrorSurface } from '../chunk-VVJ4TK6D.js';
1
+ export { DeviceBootSplash, DeviceMirror, MirrorSurface } from '../chunk-NGW34POA.js';
2
2
  import '../chunk-OEZFYKL6.js';
3
3
  import '../chunk-E7WMHM63.js';
4
4
  import '../chunk-Q63FQ7B5.js';
5
5
  import '../chunk-BUW45GM2.js';
6
6
  import '../chunk-LAZ3RQ7X.js';
7
+ import '../chunk-H37NHOYU.js';
7
8
  import '../chunk-A5VNENHD.js';
8
9
  import '../chunk-JTFZSFFA.js';
9
10
  import '../chunk-B2BOVLI6.js';
@@ -1,14 +1,15 @@
1
- export { BulkInstallAppsDialog, DeleteDeviceDialog, DeviceCard, DeviceConnect, DeviceDetailDrawer, DeviceEditDialog, DeviceSelector, DeviceTerminal, DevicesPage, FileManager, FingerprintPanel, GroupMirrorModal, NodeRegister, RecycleBinPanel, RefreshParamsButton, RunScriptDialog, ScriptParamForm, SharedParamsForm, ShortcutBar, ShortcutEditDialog, ShortcutRunDialog, TagEditor, TaskAgentDialog, resolveSharedRow, variablesToParams } from '../chunk-LTZCKFAZ.js';
1
+ export { BulkInstallAppsDialog, DeleteDeviceDialog, DeviceCard, DeviceConnect, DeviceDetailDrawer, DeviceEditDialog, DeviceSelector, DeviceTerminal, DevicesPage, FileManager, FingerprintPanel, GroupMirrorModal, NodeRegister, RecycleBinPanel, RefreshParamsButton, RunScriptDialog, ScriptParamForm, SharedParamsForm, ShortcutBar, ShortcutEditDialog, ShortcutRunDialog, TagEditor, TaskAgentDialog, resolveSharedRow, variablesToParams } from '../chunk-UJO7BJUV.js';
2
2
  import '../chunk-T3QVYTOT.js';
3
- import '../chunk-FW23FLAF.js';
4
- import '../chunk-VVJ4TK6D.js';
3
+ import '../chunk-M4DO7SSZ.js';
4
+ import '../chunk-NGW34POA.js';
5
5
  import '../chunk-OEZFYKL6.js';
6
6
  import '../chunk-E7WMHM63.js';
7
- import '../chunk-P2Y655SL.js';
8
- import '../chunk-EVHTAXQG.js';
7
+ import '../chunk-SAB5CH2K.js';
8
+ import '../chunk-YFF7VLNT.js';
9
9
  export { createAgentTaskRunner, preflightTaskAgentDevice } from '../chunk-Q63FQ7B5.js';
10
10
  import '../chunk-BUW45GM2.js';
11
11
  import '../chunk-LAZ3RQ7X.js';
12
+ import '../chunk-H37NHOYU.js';
12
13
  import '../chunk-A5VNENHD.js';
13
14
  import '../chunk-JTFZSFFA.js';
14
15
  import '../chunk-B2BOVLI6.js';
package/dist/ui/editor.js CHANGED
@@ -1,11 +1,12 @@
1
- import { ScriptStudio } from '../chunk-6S3XLY5O.js';
1
+ import { ScriptStudio } from '../chunk-BYL2S2H6.js';
2
2
  import { useAixNav } from '../chunk-5BMFMDQR.js';
3
3
  import { useAixT } from '../chunk-T3QVYTOT.js';
4
- import '../chunk-FW23FLAF.js';
5
- import { Select, cn } from '../chunk-EVHTAXQG.js';
4
+ import '../chunk-M4DO7SSZ.js';
5
+ import { Select, cn } from '../chunk-YFF7VLNT.js';
6
6
  import '../chunk-Q63FQ7B5.js';
7
7
  import '../chunk-BUW45GM2.js';
8
8
  import '../chunk-LAZ3RQ7X.js';
9
+ import '../chunk-H37NHOYU.js';
9
10
  import { useClient } from '../chunk-A5VNENHD.js';
10
11
  import '../chunk-JTFZSFFA.js';
11
12
  import '../chunk-B2BOVLI6.js';
package/dist/ui/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export { ControlBar, MirrorView } from '../chunk-E7WMHM63.js';
2
- import { Button, Input } from '../chunk-EVHTAXQG.js';
2
+ import { Button, Input } from '../chunk-YFF7VLNT.js';
3
+ import '../chunk-H37NHOYU.js';
3
4
  import { useScript, useEnvRun, useClient } from '../chunk-A5VNENHD.js';
4
5
  import '../chunk-JTFZSFFA.js';
5
6
  import { summarizeEnv, envBlocker, detectEnvOs } from '../chunk-B2BOVLI6.js';
@@ -1,8 +1,9 @@
1
1
  import { useAixT } from '../chunk-T3QVYTOT.js';
2
- import { Select, Button, cn, Input, Dialog } from '../chunk-EVHTAXQG.js';
2
+ import { Select, Button, cn, Input, Dialog } from '../chunk-YFF7VLNT.js';
3
3
  import { useInspectorView, useDevicesView, useLocators } from '../chunk-Q63FQ7B5.js';
4
4
  import '../chunk-BUW45GM2.js';
5
5
  import '../chunk-LAZ3RQ7X.js';
6
+ import '../chunk-H37NHOYU.js';
6
7
  import { useClient } from '../chunk-A5VNENHD.js';
7
8
  import '../chunk-JTFZSFFA.js';
8
9
  import '../chunk-B2BOVLI6.js';
@@ -1 +1,2 @@
1
- export { Badge, Button, Dialog, Drawer, Input, Popover, Select, ToastViewport, cn, useToast } from '../../chunk-EVHTAXQG.js';
1
+ export { Badge, Button, Dialog, Drawer, Input, Select, ToastViewport, cn, useToast } from '../../chunk-YFF7VLNT.js';
2
+ export { Popover } from '../../chunk-H37NHOYU.js';
@@ -1,9 +1,10 @@
1
- export { CodeEditor, DeviceSelect, RunPanel, ScriptParamEditor, ScriptStudio, TimelineStep } from '../chunk-6S3XLY5O.js';
2
- export { LogConsole } from '../chunk-FW23FLAF.js';
3
- import '../chunk-EVHTAXQG.js';
1
+ export { CodeEditor, DeviceSelect, RunPanel, ScriptParamEditor, ScriptStudio, TimelineStep } from '../chunk-BYL2S2H6.js';
2
+ export { LogConsole } from '../chunk-M4DO7SSZ.js';
3
+ import '../chunk-YFF7VLNT.js';
4
4
  import '../chunk-Q63FQ7B5.js';
5
5
  import '../chunk-BUW45GM2.js';
6
6
  import '../chunk-LAZ3RQ7X.js';
7
+ import '../chunk-H37NHOYU.js';
7
8
  import '../chunk-A5VNENHD.js';
8
9
  import '../chunk-JTFZSFFA.js';
9
10
  import '../chunk-B2BOVLI6.js';
@@ -1,9 +1,10 @@
1
1
  import { useAixNav } from '../chunk-5BMFMDQR.js';
2
2
  import { useAixT } from '../chunk-T3QVYTOT.js';
3
- import { cn, Badge, Button, Input } from '../chunk-EVHTAXQG.js';
3
+ import { cn, Badge, Button, Input } from '../chunk-YFF7VLNT.js';
4
4
  import { useScripts } from '../chunk-Q63FQ7B5.js';
5
5
  import '../chunk-BUW45GM2.js';
6
6
  import '../chunk-LAZ3RQ7X.js';
7
+ import '../chunk-H37NHOYU.js';
7
8
  import '../chunk-A5VNENHD.js';
8
9
  import '../chunk-JTFZSFFA.js';
9
10
  import '../chunk-B2BOVLI6.js';
package/dist/ui/tasks.js CHANGED
@@ -1,14 +1,15 @@
1
- import { SharedParamsForm, resolveSharedRow } from '../chunk-LTZCKFAZ.js';
1
+ import { SharedParamsForm, resolveSharedRow } from '../chunk-UJO7BJUV.js';
2
2
  import { useAixT } from '../chunk-T3QVYTOT.js';
3
- import '../chunk-FW23FLAF.js';
4
- import '../chunk-VVJ4TK6D.js';
3
+ import '../chunk-M4DO7SSZ.js';
4
+ import '../chunk-NGW34POA.js';
5
5
  import '../chunk-OEZFYKL6.js';
6
6
  import '../chunk-E7WMHM63.js';
7
- import '../chunk-P2Y655SL.js';
8
- import { Button, cn, Select, Input, Badge } from '../chunk-EVHTAXQG.js';
7
+ import '../chunk-SAB5CH2K.js';
8
+ import { Button, cn, Select, Input, Badge } from '../chunk-YFF7VLNT.js';
9
9
  import { useDevicesView, useAutomationQueue, useApiTokens } from '../chunk-Q63FQ7B5.js';
10
10
  import { targetParam, variablesToSchema, schemaDefaults } from '../chunk-BUW45GM2.js';
11
11
  import '../chunk-LAZ3RQ7X.js';
12
+ import '../chunk-H37NHOYU.js';
12
13
  import { useClient, useAixConfig } from '../chunk-A5VNENHD.js';
13
14
  import '../chunk-JTFZSFFA.js';
14
15
  import '../chunk-B2BOVLI6.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aixnn/aixautots",
3
- "version": "0.6.3",
3
+ "version": "0.6.4",
4
4
  "type": "module",
5
5
  "license": "UNLICENSED",
6
6
  "publishConfig": {