@aixnn/aixautots 0.6.10 → 0.6.13

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 (51) hide show
  1. package/dist/{automation-queue-CvrWEOw2.d.ts → automation-queue-BFWqw32O.d.ts} +2 -2
  2. package/dist/{chunk-PUEKOYSH.js → chunk-2KPZSPV6.js} +131 -3
  3. package/dist/{chunk-UH5OYPXE.js → chunk-7BJPVSEZ.js} +205 -18
  4. package/dist/{chunk-LR5LJJNM.js → chunk-HMDUSVQ3.js} +4 -4
  5. package/dist/{chunk-E7WMHM63.js → chunk-MBBVYSPD.js} +7 -0
  6. package/dist/{chunk-5KZB6M2S.js → chunk-Q5I63UYT.js} +127 -419
  7. package/dist/{chunk-7IXBWJHB.js → chunk-QEK25NUA.js} +5 -5
  8. package/dist/chunk-QFGMQLRB.js +405 -0
  9. package/dist/{chunk-LO3XD4T5.js → chunk-QRIWTPN3.js} +114 -4
  10. package/dist/{chunk-D7J4EQTA.js → chunk-S5N4EOCP.js} +1 -1
  11. package/dist/{chunk-NEQFR75E.js → chunk-SKI7TINK.js} +349 -420
  12. package/dist/{chunk-SL6M6CC6.js → chunk-T6X6TWHK.js} +3 -3
  13. package/dist/{chunk-XCYGBYFC.js → chunk-U4QW45MB.js} +208 -126
  14. package/dist/{chunk-SKTL6ACT.js → chunk-VMA3QOYR.js} +3 -3
  15. package/dist/chunk-ZCTAYVPK.js +1 -0
  16. package/dist/{config-BUH2EYHO.d.ts → config-UmU2_q5M.d.ts} +173 -2
  17. package/dist/core/index.d.ts +29 -11
  18. package/dist/core/index.js +2 -2
  19. package/dist/{device-normalize-DzuVemCy.d.ts → device-normalize-CWJFr_sf.d.ts} +7 -4
  20. package/dist/device-session-3XK2SZDF.js +1 -0
  21. package/dist/i18n/index.js +1 -1
  22. package/dist/{mirror-session-D2YY9mKf.d.ts → mirror-session-Cy20lIHP.d.ts} +14 -4
  23. package/dist/react/index.d.ts +9 -9
  24. package/dist/react/index.js +3 -3
  25. package/dist/{script-debugger-Csm4CrfY.d.ts → script-debugger-F5UGUq5t.d.ts} +1 -1
  26. package/dist/{task-agent-runner-C4WfT77g.d.ts → task-agent-runner-Cj_u-3DS.d.ts} +3 -3
  27. package/dist/{types-BfIeUpsU.d.ts → types-BvrppNIZ.d.ts} +34 -2
  28. package/dist/ui/billing.d.ts +2 -2
  29. package/dist/ui/billing.js +14 -8
  30. package/dist/ui/device-create.d.ts +7 -5
  31. package/dist/ui/device-create.js +8 -7
  32. package/dist/ui/device-mirror.js +7 -7
  33. package/dist/ui/devices.d.ts +5 -5
  34. package/dist/ui/devices.js +12 -11
  35. package/dist/ui/editor.d.ts +2 -2
  36. package/dist/ui/editor.js +7 -7
  37. package/dist/ui/index.d.ts +5 -4
  38. package/dist/ui/index.js +9 -7
  39. package/dist/ui/inspector.js +5 -5
  40. package/dist/ui/ip-commerce.d.ts +26 -0
  41. package/dist/ui/ip-commerce.js +8 -0
  42. package/dist/ui/market.js +4 -4
  43. package/dist/ui/mirror.d.ts +5 -4
  44. package/dist/ui/mirror.js +1 -1
  45. package/dist/ui/primitives/index.js +1 -1
  46. package/dist/ui/script-studio.js +6 -6
  47. package/dist/ui/scripts.d.ts +1 -1
  48. package/dist/ui/scripts.js +5 -5
  49. package/dist/ui/tasks.js +12 -11
  50. package/package.json +6 -2
  51. package/dist/device-session-7MKEJTIA.js +0 -1
@@ -1,6 +1,6 @@
1
- import { useAixT } from './chunk-LO3XD4T5.js';
2
- import { Button } from './chunk-SKTL6ACT.js';
3
- import { useClient } from './chunk-7IXBWJHB.js';
1
+ import { useAixT } from './chunk-QRIWTPN3.js';
2
+ import { Button } from './chunk-VMA3QOYR.js';
3
+ import { useClient } from './chunk-QEK25NUA.js';
4
4
  import { useSyncExternalStore, useState, useEffect } from 'react';
5
5
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
6
6
 
@@ -1,12 +1,76 @@
1
- import { MirrorView, ControlBar } from './chunk-E7WMHM63.js';
1
+ import { ControlBar, MirrorView } from './chunk-MBBVYSPD.js';
2
2
  import { canConnectPhysicalDevice } from './chunk-ZB5ET67B.js';
3
- import { useAixT } from './chunk-LO3XD4T5.js';
4
- import { Dialog, Select, Button, Popover } from './chunk-SKTL6ACT.js';
5
- import { useClient, useDevices, useMirror } from './chunk-7IXBWJHB.js';
3
+ import { useAixT } from './chunk-QRIWTPN3.js';
4
+ import { Dialog, Select, Button, Popover } from './chunk-VMA3QOYR.js';
5
+ import { useClient, useDevices, useMirror, createAgentTaskRunner, useTaskAgentRun } from './chunk-QEK25NUA.js';
6
6
  import { useState, useRef, useEffect, useId, useCallback, useMemo } from 'react';
7
- import { X, PanelsTopLeft, Check, Settings2, VolumeX, Volume2, RotateCw, Minimize2, Maximize2, Rocket, Loader2, Square, Video, Download } from 'lucide-react';
7
+ import { ClipboardPaste, Wrench, Check, Settings2, VolumeX, Volume2, RotateCw, X, PanelsTopLeft, Minimize2, Maximize2, Rocket, Loader2, Square, Video, Download } from 'lucide-react';
8
8
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
9
9
 
10
+ function MirrorAiChat({ deviceId }) {
11
+ const client = useClient();
12
+ const runner = useMemo(() => createAgentTaskRunner(client.cfg), [client.cfg]);
13
+ const task = useTaskAgentRun(runner);
14
+ const [prompt, setPrompt] = useState("");
15
+ const [submitted, setSubmitted] = useState("");
16
+ const [history, setHistory] = useState([]);
17
+ const [agent, setAgent] = useState("claude");
18
+ const [starting, setStarting] = useState(false);
19
+ const target = task.devices[0];
20
+ const submit = async () => {
21
+ const text = prompt.trim();
22
+ if (!text || task.running || starting) return;
23
+ if (submitted) setHistory((items) => [...items, { prompt: submitted, status: target?.status ?? "", logs: task.logs.map((entry) => entry.msg) }]);
24
+ setStarting(true);
25
+ setSubmitted(text);
26
+ setPrompt("");
27
+ try {
28
+ await task.start({ agent, devices: [{ id: deviceId, name: deviceId }], prompt: text, concurrency: 1 });
29
+ } finally {
30
+ setStarting(false);
31
+ }
32
+ };
33
+ return /* @__PURE__ */ jsxs("div", { className: "flex min-h-0 flex-1 flex-col gap-3", children: [
34
+ /* @__PURE__ */ jsxs("div", { className: "min-h-0 flex-1 space-y-3 overflow-y-auto text-xs", "aria-live": "polite", children: [
35
+ !submitted && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground", children: "\u63CF\u8FF0\u4F60\u5E0C\u671B\u8BBE\u5907\u5B8C\u6210\u7684\u64CD\u4F5C\uFF0C\u6267\u884C\u8FC7\u7A0B\u548C\u7ED3\u679C\u4F1A\u663E\u793A\u5728\u8FD9\u91CC\u3002" }),
36
+ history.map((item, i) => /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
37
+ /* @__PURE__ */ jsx("div", { className: "ml-4 whitespace-pre-wrap rounded-lg bg-primary/10 p-3", children: item.prompt }),
38
+ /* @__PURE__ */ jsxs("p", { className: "rounded-md bg-secondary p-2", children: [
39
+ "\u6267\u884C\u72B6\u6001\uFF1A",
40
+ item.status
41
+ ] }),
42
+ item.logs.map((line, j) => /* @__PURE__ */ jsx("p", { className: "whitespace-pre-wrap break-words text-muted-foreground", children: line }, j))
43
+ ] }, i)),
44
+ submitted && /* @__PURE__ */ jsx("div", { className: "ml-4 whitespace-pre-wrap rounded-lg bg-primary/10 p-3", children: submitted }),
45
+ target && /* @__PURE__ */ jsxs("p", { className: "rounded-md bg-secondary p-2", children: [
46
+ "\u6267\u884C\u72B6\u6001\uFF1A",
47
+ target.status,
48
+ target.error ? ` \xB7 ${target.error}` : "",
49
+ target.blocker?.message ? ` \xB7 ${target.blocker.message}` : ""
50
+ ] }),
51
+ task.logs.map((entry, i) => /* @__PURE__ */ jsx("p", { className: "whitespace-pre-wrap break-words text-muted-foreground", children: entry.msg }, i)),
52
+ task.error && /* @__PURE__ */ jsx("p", { role: "alert", className: "break-words text-destructive", children: task.error })
53
+ ] }),
54
+ target?.status === "blocked" && /* @__PURE__ */ jsx("button", { type: "button", onClick: () => void task.approveDevice(deviceId), className: "min-h-11 rounded border border-border px-3 text-xs", children: "\u6279\u51C6\u7EE7\u7EED" }),
55
+ /* @__PURE__ */ jsxs("form", { onSubmit: (e) => {
56
+ e.preventDefault();
57
+ void submit();
58
+ }, className: "space-y-2 border-t border-border pt-3", children: [
59
+ /* @__PURE__ */ jsxs("label", { className: "block text-xs", children: [
60
+ "\u6267\u884C Agent ",
61
+ /* @__PURE__ */ jsxs("select", { "aria-label": "\u6267\u884C Agent", value: agent, disabled: task.running || starting, onChange: (e) => setAgent(e.target.value), className: "ml-2 rounded border border-border bg-background p-1", children: [
62
+ /* @__PURE__ */ jsx("option", { value: "claude", children: "Claude" }),
63
+ /* @__PURE__ */ jsx("option", { value: "codex", children: "Codex" })
64
+ ] })
65
+ ] }),
66
+ /* @__PURE__ */ jsxs("label", { className: "block text-xs", children: [
67
+ "\u64CD\u4F5C\u6307\u4EE4",
68
+ /* @__PURE__ */ jsx("textarea", { "aria-label": "\u64CD\u4F5C\u6307\u4EE4", value: prompt, onChange: (e) => setPrompt(e.target.value), placeholder: "\u4F8B\u5982\uFF1A\u6253\u5F00\u8BBE\u7F6E\u5E76\u67E5\u770B\u7F51\u7EDC\u72B6\u6001", rows: 3, className: "mt-1 w-full resize-y rounded border border-border bg-secondary p-2 text-sm" })
69
+ ] }),
70
+ task.running || starting ? /* @__PURE__ */ jsx("button", { type: "button", disabled: !task.runId, onClick: () => void task.cancelAll(), className: "min-h-11 w-full rounded border border-border text-xs disabled:opacity-40", children: "\u505C\u6B62\u6267\u884C" }) : /* @__PURE__ */ jsx("button", { type: "submit", disabled: !prompt.trim() || !runner.available, className: "min-h-11 w-full rounded bg-primary text-xs text-primary-foreground disabled:opacity-40", children: "\u53D1\u9001\u5E76\u6267\u884C" })
71
+ ] })
72
+ ] });
73
+ }
10
74
  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";
11
75
  function MirrorActions({ deviceId, stream, ready, platform = "android" }) {
12
76
  const client = useClient();
@@ -984,7 +1048,7 @@ function AndroidMirrorSurface(props) {
984
1048
  return () => clearTimeout(timer);
985
1049
  }, [notProvisioned, loading, refetch]);
986
1050
  if (loading && devices === null || error && devices === null || notProvisioned) {
987
- return /* @__PURE__ */ jsxs("div", { className: `flex min-h-0 flex-col items-center justify-center gap-3 rounded-lg bg-black/80 p-6 text-center text-white ${props.className ?? ""}`, role: "status", children: [
1051
+ return /* @__PURE__ */ jsxs(MirrorStatusShell, { ...props, children: [
988
1052
  /* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: error ? "\u65E0\u6CD5\u6838\u5BF9\u8BBE\u5907\u72B6\u6001" : notProvisioned ? provision?.status === "pending" ? "\u8BBE\u5907\u6B63\u5728\u521B\u5EFA" : "\u8BBE\u5907\u521B\u5EFA\u672A\u5B8C\u6210" : "\u6B63\u5728\u6838\u5BF9\u8BBE\u5907\u72B6\u6001\u2026" }),
989
1053
  notProvisioned && /* @__PURE__ */ jsx("p", { className: "max-w-sm text-xs text-white/70", children: provision?.error || (provision?.status === "pending" ? "\u521B\u5EFA\u5B8C\u6210\u540E\u5C06\u81EA\u52A8\u8FDE\u63A5\u753B\u9762\u3002" : "\u521B\u5EFA\u7ED3\u679C\u5C1A\u672A\u786E\u8BA4\uFF0C\u8BF7\u6838\u5BF9\u539F\u521B\u5EFA\u4EFB\u52A1\uFF1B\u5F53\u524D\u6CA1\u6709\u53EF\u8FDE\u63A5\u7684\u8BBE\u5907\u753B\u9762\u3002") }),
990
1054
  error && /* @__PURE__ */ jsx("p", { className: "text-xs text-white/70", children: "\u8BF7\u5237\u65B0\u72B6\u6001\u540E\u91CD\u8BD5\u3002" }),
@@ -994,7 +1058,7 @@ function AndroidMirrorSurface(props) {
994
1058
  ] });
995
1059
  }
996
1060
  if (needsRecovery && recoveryDevice) {
997
- return /* @__PURE__ */ jsxs("div", { className: `flex min-h-0 flex-col items-center justify-center gap-3 rounded-lg bg-black/80 p-6 text-center text-white ${props.className ?? ""}`, role: "status", children: [
1061
+ return /* @__PURE__ */ jsxs(MirrorStatusShell, { ...props, children: [
998
1062
  /* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: t("deviceConnect.sessionClosed") }),
999
1063
  /* @__PURE__ */ jsx("p", { className: "max-w-sm text-xs text-white/70", children: t("deviceConnect.recoveryExplanation") }),
1000
1064
  /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
@@ -1010,9 +1074,34 @@ function AndroidMirrorSurface(props) {
1010
1074
  }
1011
1075
  return /* @__PURE__ */ jsx(WebRtcMirrorSurface, { ...props }, props.deviceId);
1012
1076
  }
1077
+ function MirrorStatusShell({ videoAspect, className, children }) {
1078
+ return /* @__PURE__ */ jsxs("div", { className: `flex min-h-0 flex-col items-center gap-2 ${className ?? ""}`, children: [
1079
+ /* @__PURE__ */ jsxs("div", { className: `flex min-h-0 max-w-[96vw] flex-1 items-stretch justify-center gap-2 ${videoAspect ? "w-max" : "w-full"}`, children: [
1080
+ /* @__PURE__ */ jsx("div", { "aria-hidden": "true", className: "w-[54px] shrink-0" }),
1081
+ /* @__PURE__ */ jsx(
1082
+ "div",
1083
+ {
1084
+ role: "status",
1085
+ className: `flex min-h-0 flex-col items-center justify-center gap-3 overflow-hidden rounded-lg bg-black/80 p-6 text-center text-white ${videoAspect ? "h-full shrink-0" : "h-full flex-1"}`,
1086
+ style: videoAspect ? { aspectRatio: String(videoAspect), maxHeight: `calc((96vw - 3.5rem - 0px) / ${videoAspect})` } : void 0,
1087
+ children
1088
+ }
1089
+ )
1090
+ ] }),
1091
+ /* @__PURE__ */ jsxs("div", { "aria-hidden": "true", className: "invisible flex items-center justify-center gap-1 rounded-xl border border-border px-2 py-1", children: [
1092
+ /* @__PURE__ */ jsx(ControlBar, { onHome: () => {
1093
+ }, onBack: () => {
1094
+ }, onMenu: () => {
1095
+ } }),
1096
+ /* @__PURE__ */ jsx("span", { className: "h-11 w-11" })
1097
+ ] })
1098
+ ] });
1099
+ }
1013
1100
  function WebRtcMirrorSurface({ deviceId, platform = "android", onSize, videoAspect, shortcutBar, className }) {
1014
1101
  const { stream, error, sendInput, setQuality, session } = useMirror(deviceId);
1015
1102
  const [pasteContent, setPasteContent] = useState("");
1103
+ const [pasteOpen, setPasteOpen] = useState(false);
1104
+ const [actionsOpen, setActionsOpen] = useState(false);
1016
1105
  const [panelOpen, setPanelOpen] = useState(false);
1017
1106
  const [panelMounted, setPanelMounted] = useState(false);
1018
1107
  const panelId = useId();
@@ -1123,13 +1212,103 @@ function WebRtcMirrorSurface({ deviceId, platform = "android", onSize, videoAspe
1123
1212
  );
1124
1213
  return /* @__PURE__ */ jsxs("div", { className: `flex min-h-0 flex-col items-center gap-2 ${className ?? ""}`, children: [
1125
1214
  /* @__PURE__ */ jsxs("div", { className: `flex min-h-0 max-w-[96vw] flex-1 items-stretch justify-center gap-2 ${videoAspect ? "w-max" : "w-full"}`, children: [
1215
+ /* @__PURE__ */ jsxs("aside", { "aria-label": "\u8BBE\u5907\u5DE5\u5177\u680F", className: "flex shrink-0 flex-col items-center gap-1 rounded-lg border border-border bg-background p-1 text-foreground", children: [
1216
+ /* @__PURE__ */ jsx("button", { type: "button", "aria-label": "\u7C98\u8D34\u6587\u672C", title: "\u7C98\u8D34\u6587\u672C", onClick: () => setPasteOpen(true), className: "flex h-11 w-11 items-center justify-center rounded-md hover:bg-secondary", children: /* @__PURE__ */ jsx(ClipboardPaste, { className: "h-4 w-4" }) }),
1217
+ /* @__PURE__ */ jsx("button", { type: "button", "aria-label": "\u8BBE\u5907\u64CD\u4F5C", title: "\u8BBE\u5907\u64CD\u4F5C", onClick: () => setActionsOpen(true), className: "flex h-11 w-11 items-center justify-center rounded-md hover:bg-secondary", children: /* @__PURE__ */ jsx(Wrench, { className: "h-4 w-4" }) }),
1218
+ /* @__PURE__ */ jsx(Popover, { className: "left-full top-0 !right-auto ml-2 !mt-0 !min-w-[140px]", trigger: ({ open, toggle }) => /* @__PURE__ */ jsx(
1219
+ "button",
1220
+ {
1221
+ type: "button",
1222
+ "aria-label": "\u753B\u8D28\u6863\u4F4D",
1223
+ "aria-expanded": open,
1224
+ "aria-haspopup": "menu",
1225
+ onClick: toggle,
1226
+ className: "flex h-11 w-11 items-center justify-center rounded-md text-xs text-foreground hover:bg-secondary",
1227
+ title: "\u753B\u8D28\u6863\u4F4D",
1228
+ children: /* @__PURE__ */ jsx(Settings2, { className: "h-4 w-4" })
1229
+ }
1230
+ ), children: (close) => /* @__PURE__ */ jsx("div", { role: "menu", "aria-label": "\u9009\u62E9\u753B\u8D28", children: Object.keys(PROFILE_LABELS).map((p) => /* @__PURE__ */ jsxs(
1231
+ "button",
1232
+ {
1233
+ type: "button",
1234
+ role: "menuitemradio",
1235
+ "aria-checked": profile === p,
1236
+ onClick: () => {
1237
+ changeProfile(p, true);
1238
+ close();
1239
+ },
1240
+ className: "flex w-full items-center justify-between gap-4 rounded px-2 py-2 text-xs text-foreground hover:bg-secondary",
1241
+ children: [
1242
+ PROFILE_LABELS[p],
1243
+ profile === p && /* @__PURE__ */ jsx(Check, { className: "h-3.5 w-3.5" })
1244
+ ]
1245
+ },
1246
+ p
1247
+ )) }) }),
1248
+ /* @__PURE__ */ jsx(Popover, { className: "left-full top-0 !right-auto ml-2 !mt-0 !min-w-0", trigger: ({ open, toggle }) => /* @__PURE__ */ jsx(
1249
+ "button",
1250
+ {
1251
+ type: "button",
1252
+ "aria-label": "\u97F3\u91CF",
1253
+ "aria-expanded": open,
1254
+ "aria-haspopup": "dialog",
1255
+ onClick: toggle,
1256
+ title: `\u97F3\u91CF ${volume}%`,
1257
+ className: "flex h-11 w-11 items-center justify-center rounded-md text-foreground hover:bg-secondary",
1258
+ children: volume === 0 ? /* @__PURE__ */ jsx(VolumeX, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(Volume2, { className: "h-4 w-4" })
1259
+ }
1260
+ ), children: () => /* @__PURE__ */ jsxs("div", { role: "dialog", "aria-label": "\u97F3\u91CF\u8C03\u8282", className: "flex flex-col items-center gap-2", children: [
1261
+ /* @__PURE__ */ jsx(
1262
+ "input",
1263
+ {
1264
+ type: "range",
1265
+ "aria-label": "\u64AD\u653E\u97F3\u91CF",
1266
+ min: 0,
1267
+ max: 100,
1268
+ value: volume,
1269
+ style: { writingMode: "vertical-lr", direction: "rtl", width: 24, height: 112 },
1270
+ disabled: !stream,
1271
+ onChange: (e) => {
1272
+ const next = Number(e.target.value);
1273
+ setVolume(next);
1274
+ }
1275
+ }
1276
+ ),
1277
+ /* @__PURE__ */ jsxs("span", { className: "whitespace-nowrap text-xs text-foreground", children: [
1278
+ volume,
1279
+ "%"
1280
+ ] }),
1281
+ volume > 0 && !hasAudio && /* @__PURE__ */ jsx("span", { role: "status", className: "whitespace-nowrap text-xs text-muted-foreground", children: "\u7B49\u5F85\u97F3\u9891\u6D41" })
1282
+ ] }) }),
1283
+ clipboardConflict && /* @__PURE__ */ jsxs(Fragment, { children: [
1284
+ /* @__PURE__ */ jsx("button", { type: "button", onClick: () => resolveConflict("local"), className: "text-xs underline", children: "\u4FDD\u7559\u672C\u673A\u526A\u8D34\u677F" }),
1285
+ /* @__PURE__ */ jsx("button", { type: "button", onClick: () => resolveConflict("device"), className: "text-xs underline", children: "\u4FDD\u7559\u8BBE\u5907\u526A\u8D34\u677F" })
1286
+ ] }),
1287
+ clipboardError && /* @__PURE__ */ jsxs("span", { role: "status", className: "text-xs text-destructive", children: [
1288
+ "\u526A\u8D34\u677F\u540C\u6B65\u5931\u8D25\uFF1A",
1289
+ clipboardError
1290
+ ] }),
1291
+ platform === "android" && /* @__PURE__ */ jsx(
1292
+ "button",
1293
+ {
1294
+ type: "button",
1295
+ onClick: toggleOrientation,
1296
+ "aria-label": landscape ? "\u5207\u56DE\u7AD6\u5C4F" : "\u5207\u6362\u6A2A\u5C4F",
1297
+ title: landscape ? "\u5207\u56DE\u7AD6\u5C4F" : "\u5207\u6362\u6A2A\u5C4F",
1298
+ "aria-pressed": landscape,
1299
+ className: `flex h-11 w-11 items-center justify-center rounded-md text-xs outline-none hover:bg-card ${landscape ? "bg-primary/15 text-primary" : "bg-secondary text-foreground"}`,
1300
+ children: /* @__PURE__ */ jsx(RotateCw, { className: "h-3.5 w-3.5" })
1301
+ }
1302
+ ),
1303
+ shortcutBar
1304
+ ] }),
1126
1305
  /* @__PURE__ */ jsxs(
1127
1306
  "div",
1128
1307
  {
1129
1308
  className: `relative min-h-0 overflow-hidden rounded-lg ${videoAspect ? "h-full shrink-0" : "h-full flex-1"}`,
1130
1309
  style: videoAspect ? {
1131
1310
  aspectRatio: String(videoAspect),
1132
- maxHeight: `calc((96vw - ${panelOpen ? "min(16rem, 45vw) - 0.5rem" : "0px"}) / ${videoAspect})`
1311
+ maxHeight: `calc((96vw - 3.5rem - ${panelOpen ? "min(16rem, 45vw) - 0.5rem" : "0px"}) / ${videoAspect})`
1133
1312
  } : void 0,
1134
1313
  children: [
1135
1314
  stream && /* @__PURE__ */ jsx(
@@ -1167,38 +1346,25 @@ function WebRtcMirrorSurface({ deviceId, platform = "android", onSize, videoAspe
1167
1346
  /* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: "AI \u63A7\u5236" }),
1168
1347
  /* @__PURE__ */ jsx("button", { type: "button", "aria-label": "\u6536\u8D77 AI \u63A7\u5236\u9762\u677F", onClick: closePanel, className: "flex h-11 w-11 items-center justify-center rounded-md hover:bg-secondary focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary", children: /* @__PURE__ */ jsx(X, { "aria-hidden": "true", className: "h-4 w-4" }) })
1169
1348
  ] }),
1170
- /* @__PURE__ */ jsx(MirrorActions, { deviceId, stream, ready: hasFrame, platform }),
1171
- shortcutBar,
1172
- /* @__PURE__ */ jsxs("form", { className: "flex flex-col gap-2", onSubmit: (e) => {
1173
- e.preventDefault();
1174
- if (hasFrame && stream && pasteContent.trim()) sendInput({ t: "text", value: pasteContent });
1175
- }, children: [
1176
- /* @__PURE__ */ jsxs("label", { className: "text-xs font-medium", children: [
1177
- "\u547D\u4EE4 / \u7C98\u8D34\u5185\u5BB9",
1178
- /* @__PURE__ */ jsx(
1179
- "textarea",
1180
- {
1181
- "aria-label": "\u547D\u4EE4 / \u7C98\u8D34\u5185\u5BB9",
1182
- value: pasteContent,
1183
- onChange: (e) => setPasteContent(e.target.value),
1184
- placeholder: "\u8F93\u5165\u6216\u7C98\u8D34\u5185\u5BB9",
1185
- rows: 5,
1186
- className: "mt-2 w-full resize-y rounded border border-border bg-secondary p-2 text-xs"
1187
- }
1188
- )
1189
- ] }),
1190
- /* @__PURE__ */ jsx("button", { type: "submit", disabled: !hasFrame || !stream || !pasteContent.trim(), className: "min-h-11 rounded bg-primary px-2 py-2 text-xs text-primary-foreground disabled:opacity-40", children: "\u7C98\u8D34\u5230\u8BBE\u5907" })
1191
- ] })
1349
+ /* @__PURE__ */ jsx(MirrorAiChat, { deviceId })
1192
1350
  ] })
1193
1351
  ] }),
1194
- /* @__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: [
1195
- /* @__PURE__ */ jsxs("button", { ref: panelButton, type: "button", "aria-expanded": panelOpen, "aria-controls": panelMounted ? panelId : void 0, onClick: () => {
1196
- setPanelMounted(true);
1197
- setPanelOpen((open) => !open);
1198
- }, className: "flex min-h-11 items-center gap-1.5 rounded-md px-3 text-xs text-foreground hover:bg-secondary focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary", children: [
1199
- /* @__PURE__ */ jsx(PanelsTopLeft, { "aria-hidden": "true", className: "h-4 w-4" }),
1200
- "AI \u63A7\u5236"
1352
+ /* @__PURE__ */ jsx(Dialog, { open: pasteOpen, onClose: () => setPasteOpen(false), title: "\u7C98\u8D34\u6587\u672C\u5230\u8BBE\u5907", description: "\u8F93\u5165\u8981\u53D1\u9001\u5230\u8BBE\u5907\u7684\u6587\u672C\u3002", children: /* @__PURE__ */ jsxs("form", { className: "flex flex-col gap-3", onSubmit: (e) => {
1353
+ e.preventDefault();
1354
+ if (hasFrame && stream && pasteContent.trim()) {
1355
+ sendInput({ t: "text", value: pasteContent });
1356
+ setPasteOpen(false);
1357
+ setPasteContent("");
1358
+ }
1359
+ }, children: [
1360
+ /* @__PURE__ */ jsxs("label", { className: "text-sm", children: [
1361
+ "\u6587\u672C\u5185\u5BB9",
1362
+ /* @__PURE__ */ jsx("textarea", { "aria-label": "\u6587\u672C\u5185\u5BB9", value: pasteContent, onChange: (e) => setPasteContent(e.target.value), rows: 5, className: "mt-2 w-full rounded border border-border bg-secondary p-2 text-sm" })
1201
1363
  ] }),
1364
+ /* @__PURE__ */ jsx("button", { type: "submit", disabled: !hasFrame || !stream || !pasteContent.trim(), className: "min-h-11 rounded bg-primary px-3 text-sm text-primary-foreground disabled:opacity-40", children: "\u7C98\u8D34\u5230\u8BBE\u5907" })
1365
+ ] }) }),
1366
+ /* @__PURE__ */ jsx(Dialog, { open: actionsOpen, onClose: () => setActionsOpen(false), title: "\u8BBE\u5907\u64CD\u4F5C", children: /* @__PURE__ */ jsx(MirrorActions, { deviceId, stream, ready: hasFrame, platform }) }),
1367
+ /* @__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: [
1202
1368
  /* @__PURE__ */ jsx(
1203
1369
  ControlBar,
1204
1370
  {
@@ -1208,94 +1374,10 @@ function WebRtcMirrorSurface({ deviceId, platform = "android", onSize, videoAspe
1208
1374
  onMenu: () => sendInput({ t: "key", code: "app_switch" })
1209
1375
  }
1210
1376
  ),
1211
- /* @__PURE__ */ jsx(Popover, { className: "bottom-full mb-2 !mt-0 !min-w-[140px]", trigger: ({ open, toggle }) => /* @__PURE__ */ jsxs(
1212
- "button",
1213
- {
1214
- type: "button",
1215
- "aria-label": "\u753B\u8D28\u6863\u4F4D",
1216
- "aria-expanded": open,
1217
- "aria-haspopup": "menu",
1218
- onClick: toggle,
1219
- className: "flex h-9 items-center gap-1.5 rounded-md px-2 text-xs text-foreground hover:bg-secondary",
1220
- title: "\u753B\u8D28\u6863\u4F4D",
1221
- children: [
1222
- /* @__PURE__ */ jsx(Settings2, { className: "h-4 w-4" }),
1223
- PROFILE_LABELS[profile]
1224
- ]
1225
- }
1226
- ), children: (close) => /* @__PURE__ */ jsx("div", { role: "menu", "aria-label": "\u9009\u62E9\u753B\u8D28", children: Object.keys(PROFILE_LABELS).map((p) => /* @__PURE__ */ jsxs(
1227
- "button",
1228
- {
1229
- type: "button",
1230
- role: "menuitemradio",
1231
- "aria-checked": profile === p,
1232
- onClick: () => {
1233
- changeProfile(p, true);
1234
- close();
1235
- },
1236
- className: "flex w-full items-center justify-between gap-4 rounded px-2 py-2 text-xs text-foreground hover:bg-secondary",
1237
- children: [
1238
- PROFILE_LABELS[p],
1239
- profile === p && /* @__PURE__ */ jsx(Check, { className: "h-3.5 w-3.5" })
1240
- ]
1241
- },
1242
- p
1243
- )) }) }),
1244
- /* @__PURE__ */ jsx(Popover, { className: "bottom-full mb-2 !mt-0 !min-w-0", trigger: ({ open, toggle }) => /* @__PURE__ */ jsx(
1245
- "button",
1246
- {
1247
- type: "button",
1248
- "aria-label": "\u97F3\u91CF",
1249
- "aria-expanded": open,
1250
- "aria-haspopup": "dialog",
1251
- onClick: toggle,
1252
- title: `\u97F3\u91CF ${volume}%`,
1253
- className: "flex h-9 w-9 items-center justify-center rounded-md text-foreground hover:bg-secondary",
1254
- children: volume === 0 ? /* @__PURE__ */ jsx(VolumeX, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(Volume2, { className: "h-4 w-4" })
1255
- }
1256
- ), children: () => /* @__PURE__ */ jsxs("div", { role: "dialog", "aria-label": "\u97F3\u91CF\u8C03\u8282", className: "flex flex-col items-center gap-2", children: [
1257
- /* @__PURE__ */ jsx(
1258
- "input",
1259
- {
1260
- type: "range",
1261
- "aria-label": "\u64AD\u653E\u97F3\u91CF",
1262
- min: 0,
1263
- max: 100,
1264
- value: volume,
1265
- style: { writingMode: "vertical-lr", direction: "rtl", width: 24, height: 112 },
1266
- disabled: !stream,
1267
- onChange: (e) => {
1268
- const next = Number(e.target.value);
1269
- setVolume(next);
1270
- }
1271
- }
1272
- ),
1273
- /* @__PURE__ */ jsxs("span", { className: "whitespace-nowrap text-xs text-foreground", children: [
1274
- volume,
1275
- "%"
1276
- ] }),
1277
- volume > 0 && !hasAudio && /* @__PURE__ */ jsx("span", { role: "status", className: "whitespace-nowrap text-xs text-muted-foreground", children: "\u7B49\u5F85\u97F3\u9891\u6D41" })
1278
- ] }) }),
1279
- clipboardConflict && /* @__PURE__ */ jsxs(Fragment, { children: [
1280
- /* @__PURE__ */ jsx("button", { type: "button", onClick: () => resolveConflict("local"), className: "text-xs underline", children: "\u4FDD\u7559\u672C\u673A\u526A\u8D34\u677F" }),
1281
- /* @__PURE__ */ jsx("button", { type: "button", onClick: () => resolveConflict("device"), className: "text-xs underline", children: "\u4FDD\u7559\u8BBE\u5907\u526A\u8D34\u677F" })
1282
- ] }),
1283
- clipboardError && /* @__PURE__ */ jsxs("span", { role: "status", className: "text-xs text-destructive", children: [
1284
- "\u526A\u8D34\u677F\u540C\u6B65\u5931\u8D25\uFF1A",
1285
- clipboardError
1286
- ] }),
1287
- platform === "android" && /* @__PURE__ */ jsx(
1288
- "button",
1289
- {
1290
- type: "button",
1291
- onClick: toggleOrientation,
1292
- "aria-label": landscape ? "\u5207\u56DE\u7AD6\u5C4F" : "\u5207\u6362\u6A2A\u5C4F",
1293
- title: landscape ? "\u5207\u56DE\u7AD6\u5C4F" : "\u5207\u6362\u6A2A\u5C4F",
1294
- "aria-pressed": landscape,
1295
- 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"}`,
1296
- children: /* @__PURE__ */ jsx(RotateCw, { className: "h-3.5 w-3.5" })
1297
- }
1298
- )
1377
+ /* @__PURE__ */ jsx("button", { ref: panelButton, type: "button", "aria-label": "AI \u63A7\u5236", title: "AI \u63A7\u5236", "aria-expanded": panelOpen, "aria-controls": panelMounted ? panelId : void 0, onClick: () => {
1378
+ setPanelMounted(true);
1379
+ setPanelOpen((open) => !open);
1380
+ }, className: "flex h-11 w-11 items-center justify-center rounded-md text-foreground hover:bg-secondary focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary", children: /* @__PURE__ */ jsx(PanelsTopLeft, { "aria-hidden": "true", className: "h-4 w-4" }) })
1299
1381
  ] })
1300
1382
  ] });
1301
1383
  }
@@ -1366,7 +1448,7 @@ function DeviceMirror({ deviceId, deviceName, platform = "android", shortcutBar,
1366
1448
  if (!open) return;
1367
1449
  const onKey = (e) => {
1368
1450
  resetActivity();
1369
- if (e.key === "Escape" && !fullscreen) onClose();
1451
+ if (e.key === "Escape" && !fullscreen && !e.defaultPrevented) onClose();
1370
1452
  };
1371
1453
  window.addEventListener("keydown", onKey);
1372
1454
  return () => window.removeEventListener("keydown", onKey);
@@ -18,13 +18,13 @@ function Dialog({
18
18
  children,
19
19
  maxWidth = "max-w-md"
20
20
  }) {
21
- return /* @__PURE__ */ jsx(DialogPrimitive.Root, { open, onOpenChange: onClose, children: /* @__PURE__ */ jsxs(DialogPrimitive.Portal, { children: [
22
- /* @__PURE__ */ jsx(DialogPrimitive.Overlay, { className: "fixed inset-0 bg-black/50 z-40" }),
21
+ return /* @__PURE__ */ jsx(DialogPrimitive.Root, { open, onOpenChange: onClose, children: /* @__PURE__ */ jsxs(DialogPrimitive.Portal, { container: typeof document !== "undefined" ? document.fullscreenElement ?? void 0 : void 0, children: [
22
+ /* @__PURE__ */ jsx(DialogPrimitive.Overlay, { className: "fixed inset-0 bg-black/50 z-[60]" }),
23
23
  /* @__PURE__ */ jsxs(
24
24
  DialogPrimitive.Content,
25
25
  {
26
26
  className: cn(
27
- "fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 bg-card border border-border rounded-lg p-6 w-full z-50 shadow-xl",
27
+ "fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 bg-card border border-border rounded-lg p-6 w-full z-[70] shadow-xl",
28
28
  maxWidth
29
29
  ),
30
30
  children: [
@@ -0,0 +1 @@
1
+