@aixnn/aixautots 0.6.13 → 0.6.20

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 (55) hide show
  1. package/dist/{automation-queue-BFWqw32O.d.ts → automation-queue-GhfQtZLm.d.ts} +2 -2
  2. package/dist/{chunk-S5N4EOCP.js → chunk-3OBCSW2J.js} +1 -1
  3. package/dist/{chunk-SKI7TINK.js → chunk-4NRIEM5Z.js} +269 -53
  4. package/dist/{chunk-VMA3QOYR.js → chunk-7RQTSTR6.js} +1 -1
  5. package/dist/{chunk-HMDUSVQ3.js → chunk-DAU3FVCV.js} +4 -4
  6. package/dist/chunk-DTXXQPOU.js +693 -0
  7. package/dist/{chunk-7BJPVSEZ.js → chunk-ED6CB3B4.js} +222 -12
  8. package/dist/{chunk-Q5I63UYT.js → chunk-FJKMRWYC.js} +97 -75
  9. package/dist/{chunk-U4QW45MB.js → chunk-H7KZUU67.js} +14 -7
  10. package/dist/{chunk-QRIWTPN3.js → chunk-HQ2L4NQ2.js} +270 -12
  11. package/dist/{chunk-QFGMQLRB.js → chunk-JQBSGFAR.js} +31 -14
  12. package/dist/{chunk-2KPZSPV6.js → chunk-OJK35AQD.js} +105 -17
  13. package/dist/chunk-QISBQ532.js +1665 -0
  14. package/dist/{chunk-T6X6TWHK.js → chunk-RFOJSDYI.js} +3 -3
  15. package/dist/{chunk-QEK25NUA.js → chunk-UEZVXYGP.js} +12 -5
  16. package/dist/{config-UmU2_q5M.d.ts → config-C79rcedl.d.ts} +53 -11
  17. package/dist/core/index.d.ts +13 -9
  18. package/dist/core/index.js +2 -2
  19. package/dist/core/network-adb-node.d.ts +23 -0
  20. package/dist/core/network-adb-node.js +171 -0
  21. package/dist/{script-debugger-F5UGUq5t.d.ts → device-channel-OiZwAqNQ.d.ts} +41 -55
  22. package/dist/{device-normalize-CWJFr_sf.d.ts → device-normalize-ODrxJb-a.d.ts} +1 -1
  23. package/dist/device-session-PVHD6PNR.js +1 -0
  24. package/dist/i18n/index.js +1 -1
  25. package/dist/{mirror-session-Cy20lIHP.d.ts → mirror-session-DifANocH.d.ts} +2 -2
  26. package/dist/react/index.d.ts +19 -12
  27. package/dist/react/index.js +3 -3
  28. package/dist/script-debugger-DjxpvdaN.d.ts +56 -0
  29. package/dist/{task-agent-runner-Cj_u-3DS.d.ts → task-agent-runner-CAt-z8gr.d.ts} +3 -3
  30. package/dist/{types-BvrppNIZ.d.ts → types-CBI5SIH5.d.ts} +103 -5
  31. package/dist/ui/billing.d.ts +43 -6
  32. package/dist/ui/billing.js +190 -309
  33. package/dist/ui/device-create.d.ts +5 -2
  34. package/dist/ui/device-create.js +8 -8
  35. package/dist/ui/device-mirror.js +6 -6
  36. package/dist/ui/devices.d.ts +5 -5
  37. package/dist/ui/devices.js +11 -11
  38. package/dist/ui/editor.d.ts +2 -2
  39. package/dist/ui/editor.js +7 -7
  40. package/dist/ui/index.d.ts +6 -4
  41. package/dist/ui/index.js +13 -492
  42. package/dist/ui/inspector.js +5 -5
  43. package/dist/ui/ip-commerce.d.ts +4 -2
  44. package/dist/ui/ip-commerce.js +6 -6
  45. package/dist/ui/market.js +4 -4
  46. package/dist/ui/mirror.d.ts +3 -3
  47. package/dist/ui/primitives/index.js +1 -1
  48. package/dist/ui/script-studio.js +6 -6
  49. package/dist/ui/scripts.d.ts +1 -1
  50. package/dist/ui/scripts.js +5 -5
  51. package/dist/ui/settings.d.ts +164 -0
  52. package/dist/ui/settings.js +10 -0
  53. package/dist/ui/tasks.js +11 -11
  54. package/package.json +9 -1
  55. package/dist/device-session-3XK2SZDF.js +0 -1
@@ -1,5 +1,5 @@
1
- import { a as RunEventKind, A as AixConfig, R as ResolvedConfig } from './config-UmU2_q5M.js';
2
- import { S as Script } from './types-BvrppNIZ.js';
1
+ import { b as RunEventKind, A as AixConfig, R as ResolvedConfig } from './config-C79rcedl.js';
2
+ import { S as Script } from './types-CBI5SIH5.js';
3
3
 
4
4
  interface FlowSubmit {
5
5
  /** Inline flow JSON (XOR scriptId). */
@@ -1,4 +1,4 @@
1
- import { cn } from './chunk-VMA3QOYR.js';
1
+ import { cn } from './chunk-7RQTSTR6.js';
2
2
  import { useRef, useMemo, useEffect } from 'react';
3
3
  import { jsx, jsxs } from 'react/jsx-runtime';
4
4
 
@@ -1,14 +1,15 @@
1
- import { LogConsole } from './chunk-S5N4EOCP.js';
2
- import { requestPreviewFrame, MirrorSurface, DeviceMirror, ConnectDevicesDialog } from './chunk-U4QW45MB.js';
1
+ import { LogConsole } from './chunk-3OBCSW2J.js';
2
+ import { requestPreviewFrame, MirrorSurface, DeviceMirror, ConnectDevicesDialog } from './chunk-H7KZUU67.js';
3
3
  import { ControlBar, MirrorView } from './chunk-MBBVYSPD.js';
4
- import { deviceProxyCapabilities, createProxyProbeGuard, proxySummaryFromDevice, isProxyApplyStatus, proxyCapabilityReason, proxyProbeExitIp, proxyProbeMessage, DeviceCreate, isProxyProbeUnsupported, isRedactedProxyUrl, isSupportedProxyUrl, redactProxyUrl } from './chunk-Q5I63UYT.js';
5
- import { IosDeviceDiagnostics } from './chunk-T6X6TWHK.js';
6
- import { IpCommercePanel } from './chunk-QFGMQLRB.js';
4
+ import { deviceProxyCapabilities, createProxyProbeGuard, proxySummaryFromDevice, isProxyApplyStatus, safeCustomProxyAddress, usesAndroidSystemProxy, normalizeManualProxyUrl, proxyCapabilityReason, proxyProbeExitIp, proxyProbeMessage, DeviceCreate, isProxyProbeUnsupported, customProxyAddress, isRedactedProxyUrl, isSupportedProxyUrl } from './chunk-FJKMRWYC.js';
5
+ import { IpCommercePanel } from './chunk-JQBSGFAR.js';
6
+ import { IosDeviceDiagnostics } from './chunk-RFOJSDYI.js';
7
7
  import { isPhysicalIos } from './chunk-ZB5ET67B.js';
8
- import { useAixT } from './chunk-QRIWTPN3.js';
9
- import { cn, Badge, Button, Dialog, Input, Popover, Select, useToast, ToastViewport, Drawer } from './chunk-VMA3QOYR.js';
10
- import { useClient, useDevicesView, useShortcutsView, GROUP_MIRROR_MAX, useGroupMirror, useScripts, useFleetRun, useTaskAgentRun, preflightTaskAgentDevice, createAgentTaskRunner, useNodesView } from './chunk-QEK25NUA.js';
11
- import { DeviceSession, pushFile, pullFile, AixError } from './chunk-2KPZSPV6.js';
8
+ import { cn, Badge, Button, Dialog, Input, Popover, Select, useToast, ToastViewport, Drawer } from './chunk-7RQTSTR6.js';
9
+ import { useAixT } from './chunk-HQ2L4NQ2.js';
10
+ import { useClient, useDevicesView, useShortcutsView, useAixConfig, GROUP_MIRROR_MAX, useGroupMirror, useScripts, useFleetRun, useTaskAgentRun, preflightTaskAgentDevice, createAgentTaskRunner, useNodesView } from './chunk-UEZVXYGP.js';
11
+ import { DeviceChannel } from './chunk-ED6CB3B4.js';
12
+ import { DeviceSession, isQueuedPowerReceipt, pushFile, pullFile, AixError } from './chunk-OJK35AQD.js';
12
13
  import { useState, useRef, useCallback, useEffect, useMemo, useLayoutEffect } from 'react';
13
14
  import * as Icons from 'lucide-react';
14
15
  import { Monitor, Eye, Play, Power, RefreshCw, Server, Pencil, Trash2, FolderPlus, Upload, ArrowUp, Folder, File, Download, Dices, ShieldCheck, AlertTriangle, X, Crown, RotateCcw, Square, Plus, Search, LayoutGrid, List, ChevronLeft, Link, Link2Off, Terminal as Terminal$1, PackagePlus, MonitorPlay, ChevronRight, ChevronDown, PlusSquare, Maximize2, Info, ChevronsLeft, ChevronsRight, Check, Copy, Tablet, Smartphone } from 'lucide-react';
@@ -329,7 +330,7 @@ function ConfirmDialog({
329
330
  }
330
331
  function ManagedProxyPanel(props) {
331
332
  const client = useClient();
332
- return /* @__PURE__ */ jsx(IpCommercePanel, { deviceId: props.deviceId, supported: props.supported, onChanged: props.onChanged }, JSON.stringify([client.cfg.baseUrl, props.ownerUserId, props.projectId, props.deviceId]));
333
+ return /* @__PURE__ */ jsx(IpCommercePanel, { deviceId: props.deviceId, supported: props.supported, onChanged: props.onChanged, regionOnly: props.regionOnly }, JSON.stringify([client.cfg.baseUrl, props.ownerUserId, props.projectId, props.deviceId]));
333
334
  }
334
335
  function supportsDataSnapshots(meta) {
335
336
  const spec = meta.spec;
@@ -2126,8 +2127,17 @@ function ShortcutEditDialog({ initial, onClose, onSaved, onDeleted }) {
2126
2127
  // src/ui/devices/shortcut-feedback.ts
2127
2128
  function powerFeedback(name, results) {
2128
2129
  const total = results.length;
2129
- const ok = results.filter((r) => r.ok).length;
2130
+ const failed = results.filter((r) => !r.ok).length;
2131
+ const queued = results.filter((r) => r.ok && isQueuedPowerReceipt(r.result)).length;
2132
+ const ok = total - failed - queued;
2130
2133
  const firstError = results.find((r) => !r.ok)?.error ?? "";
2134
+ if (queued > 0) {
2135
+ return {
2136
+ tone: "warn",
2137
+ key: failed > 0 ? "shortcutBar.queuedPartial" : "shortcutBar.queued",
2138
+ vars: { name, ok, queued, failed, error: firstError }
2139
+ };
2140
+ }
2131
2141
  if (total > 0 && ok === total) {
2132
2142
  return { tone: "ok", key: "shortcutBar.ok", vars: { name, ok, total } };
2133
2143
  }
@@ -2137,7 +2147,7 @@ function powerFeedback(name, results) {
2137
2147
  return {
2138
2148
  tone: "warn",
2139
2149
  key: "shortcutBar.partial",
2140
- vars: { name, ok, total, failed: total - ok, error: firstError }
2150
+ vars: { name, ok, total, failed, error: firstError }
2141
2151
  };
2142
2152
  }
2143
2153
  var DONE = "done";
@@ -3010,6 +3020,9 @@ function DeviceDetailDrawer({ deviceId, onClose }) {
3010
3020
  const [proxyNode, setProxyNode] = useState(null);
3011
3021
  const proxyNodeId = device?.meta.node_id;
3012
3022
  const proxyCapability = deviceProxyCapabilities(device, proxyNode);
3023
+ const spec = device?.meta.spec;
3024
+ const developerSettingsSupported = device?.platform === "android" && device.online && device.meta.provisioned === true && [void 0, "android", "redroid"].includes(device.meta.platform) && [void 0, "android", "redroid"].includes(spec?.platform) && [void 0, "android", "redroid"].includes(spec?.kind) && [void 0, "android", "redroid", "cloud"].includes(device.meta.kind) && typeof proxyNodeId === "string" && proxyNode?.id === proxyNodeId && proxyNode.status === "online" && proxyNode.reported_caps?.developer_settings?.supported === true;
3025
+ const networkAdbSupported = device?.platform === "android" && device.online && device.meta.provisioned === true && [void 0, "android", "redroid"].includes(device.meta.platform) && [void 0, "android", "redroid"].includes(spec?.platform) && [void 0, "android", "redroid"].includes(spec?.kind) && [void 0, "android", "redroid", "cloud"].includes(device.meta.kind) && typeof proxyNodeId === "string" && proxyNode?.id === proxyNodeId && proxyNode.status === "online" && proxyNode.reported_caps?.network_adb_dc_denied_v1 === true;
3013
3026
  useEffect(() => {
3014
3027
  let cancelled = false;
3015
3028
  setProxyNode(null);
@@ -3040,9 +3053,15 @@ function DeviceDetailDrawer({ deviceId, onClose }) {
3040
3053
  const [appSearching, setAppSearching] = useState(false);
3041
3054
  const [showReinstallPicker, setShowReinstallPicker] = useState(false);
3042
3055
  const [showDelete, setShowDelete] = useState(false);
3043
- const [manualProxy, setManualProxy] = useState(false);
3056
+ const [aixipsOpen, setAixipsOpen] = useState(false);
3044
3057
  const [proxyInput, setProxyInput] = useState("");
3045
- const [proxySummary, setProxySummary] = useState("");
3058
+ const [proxySavedAddress, setProxySavedAddress] = useState("");
3059
+ const [proxyAddressLoading, setProxyAddressLoading] = useState(false);
3060
+ const [proxyInputDirty, setProxyInputDirty] = useState(false);
3061
+ const proxyInputDirtyRef = useRef(false);
3062
+ const proxyAddressGeneration = useRef(0);
3063
+ const activeProxyDevice = useRef(deviceId);
3064
+ activeProxyDevice.current = deviceId;
3046
3065
  const [proxyApply, setProxyApply] = useState(null);
3047
3066
  const [proxySaving, setProxySaving] = useState(false);
3048
3067
  const [proxyProbe, setProxyProbe] = useState(null);
@@ -3138,14 +3157,17 @@ function DeviceDetailDrawer({ deviceId, onClose }) {
3138
3157
  setLocation(null);
3139
3158
  stopLocationSimulation();
3140
3159
  setProxyInput("");
3141
- setProxySummary("");
3160
+ setProxySavedAddress("");
3161
+ proxyInputDirtyRef.current = false;
3162
+ setProxyInputDirty(false);
3163
+ proxyAddressGeneration.current += 1;
3142
3164
  setProxyApply(null);
3143
3165
  setProxyProbe(null);
3144
3166
  setProxyProbeError(null);
3145
3167
  setProxyProbeUnsupported(false);
3146
3168
  return;
3147
3169
  }
3148
- setManualProxy(false);
3170
+ setAixipsOpen(false);
3149
3171
  setTab("overview");
3150
3172
  const cur = devices.find((d) => d.id === deviceId);
3151
3173
  const storedLocation = cur?.meta?.location;
@@ -3170,7 +3192,9 @@ function DeviceDetailDrawer({ deviceId, onClose }) {
3170
3192
  }
3171
3193
  const summary = proxySummaryFromDevice(cur);
3172
3194
  setProxyInput("");
3173
- setProxySummary(summary?.configured ? maskedProxySummary(summary) : "");
3195
+ setProxySavedAddress("");
3196
+ proxyInputDirtyRef.current = false;
3197
+ setProxyInputDirty(false);
3174
3198
  setProxyApply(
3175
3199
  summary && summary.observed_status && isProxyApplyStatus(summary.observed_status) ? { revision: summary.observed_revision ?? summary.desired_revision ?? 0, status: summary.observed_status } : null
3176
3200
  );
@@ -3184,6 +3208,29 @@ function DeviceDetailDrawer({ deviceId, onClose }) {
3184
3208
  client.devices.op(deviceId, { op: "screen_size" })
3185
3209
  ).then((size) => setInfo({ resolution: `${size.width}\xD7${size.height}` })).catch(() => setInfo({})).finally(() => setInfoLoading(false));
3186
3210
  }, [deviceId]);
3211
+ const selectedProxy = proxySummaryFromDevice(device);
3212
+ const selectedProxySource = device?.meta?.proxy_source?.kind;
3213
+ const selectedRevision = selectedProxy?.desired_revision;
3214
+ const selectedConfigured = selectedProxy?.configured === true && (selectedProxySource === void 0 || selectedProxySource === "custom");
3215
+ useEffect(() => {
3216
+ const generation = ++proxyAddressGeneration.current;
3217
+ setProxyAddressLoading(Boolean(deviceId && selectedConfigured));
3218
+ setProxySavedAddress("");
3219
+ if (!proxyInputDirtyRef.current) setProxyInput("");
3220
+ if (!deviceId || !selectedConfigured) return;
3221
+ void client.devices.customProxyAddress(deviceId).then((result) => {
3222
+ if (proxyAddressGeneration.current !== generation || activeProxyDevice.current !== deviceId) return;
3223
+ const address = result.configured ? safeCustomProxyAddress(result.address) ?? "" : "";
3224
+ setProxySavedAddress(address);
3225
+ if (!proxyInputDirtyRef.current) setProxyInput(address);
3226
+ }).catch(() => {
3227
+ }).finally(() => {
3228
+ if (proxyAddressGeneration.current === generation && activeProxyDevice.current === deviceId) setProxyAddressLoading(false);
3229
+ });
3230
+ return () => {
3231
+ ++proxyAddressGeneration.current;
3232
+ };
3233
+ }, [client, deviceId, selectedConfigured, selectedRevision, selectedProxySource]);
3187
3234
  useEffect(() => {
3188
3235
  if (deviceId && proxyCapability.custom && proxySummaryFromDevice(device)?.configured) void probeProxy(deviceId);
3189
3236
  }, [deviceId, proxyCapability.custom]);
@@ -3196,9 +3243,15 @@ function DeviceDetailDrawer({ deviceId, onClose }) {
3196
3243
  const handleClose = () => {
3197
3244
  onClose();
3198
3245
  };
3199
- const handleSaveProxy = async () => {
3200
- if (!deviceId || proxySaving || !proxyCapability.custom) return;
3201
- const nextProxy = proxyInput.trim();
3246
+ const handleSaveProxy = async (clear = false) => {
3247
+ if (!deviceId || proxySaving || proxyAddressLoading || !proxyCapability.custom || !clear && !proxyInputDirtyRef.current) return;
3248
+ const nextProxy = clear ? "" : normalizeManualProxyUrl(proxyInput);
3249
+ if (!clear && proxySavedAddress && !nextProxy.includes("@") && customProxyAddress(nextProxy) === proxySavedAddress) {
3250
+ proxyInputDirtyRef.current = false;
3251
+ setProxyInputDirty(false);
3252
+ setProxyInput(proxySavedAddress);
3253
+ return;
3254
+ }
3202
3255
  if (isRedactedProxyUrl(nextProxy)) {
3203
3256
  toast.error(t("drawer.proxyPasswordRequired"));
3204
3257
  return;
@@ -3208,12 +3261,18 @@ function DeviceDetailDrawer({ deviceId, onClose }) {
3208
3261
  return;
3209
3262
  }
3210
3263
  setProxySaving(true);
3264
+ const generation = ++proxyAddressGeneration.current;
3211
3265
  try {
3212
3266
  const result = await client.devices.updateProxy(deviceId, nextProxy);
3213
- setProxyInput("");
3214
- setProxySummary(nextProxy ? redactProxyUrl(nextProxy) : "");
3267
+ if (proxyAddressGeneration.current !== generation || activeProxyDevice.current !== deviceId) return;
3268
+ const address = nextProxy ? customProxyAddress(nextProxy) ?? "" : "";
3269
+ proxyInputDirtyRef.current = false;
3270
+ setProxyInputDirty(false);
3271
+ setProxyInput(address);
3272
+ setProxySavedAddress(address);
3215
3273
  setProxyApply(result.proxy_apply ?? null);
3216
3274
  await fetchDevices();
3275
+ if (activeProxyDevice.current !== deviceId) return;
3217
3276
  toast.success(nextProxy ? t("drawer.proxySaved") : t("drawer.proxyCleared"));
3218
3277
  if (nextProxy) {
3219
3278
  await probeProxy(deviceId);
@@ -3223,7 +3282,7 @@ function DeviceDetailDrawer({ deviceId, onClose }) {
3223
3282
  setProxyProbeUnsupported(false);
3224
3283
  }
3225
3284
  } catch (e) {
3226
- toast.error(`proxy: ${e.message}`);
3285
+ if (activeProxyDevice.current === deviceId) toast.error(`proxy: ${e.message}`);
3227
3286
  } finally {
3228
3287
  setProxySaving(false);
3229
3288
  }
@@ -3355,6 +3414,7 @@ function DeviceDetailDrawer({ deviceId, onClose }) {
3355
3414
  )
3356
3415
  ] })
3357
3416
  ] }),
3417
+ tab === "overview" && networkAdbSupported && deviceId && /* @__PURE__ */ jsx(NetworkAdbControl, { deviceId }, deviceId),
3358
3418
  tab === "overview" && physicalIos && device && proxyNode?.is_owner && proxyNode.status === "online" && proxyNode.reported_caps?.ios_control?.diagnostics === true && (typeof device.meta.udid === "string" || device.id.startsWith("ios-")) && /* @__PURE__ */ jsx(
3359
3419
  IosDeviceDiagnostics,
3360
3420
  {
@@ -3477,6 +3537,7 @@ function DeviceDetailDrawer({ deviceId, onClose }) {
3477
3537
  }
3478
3538
  )
3479
3539
  ] }),
3540
+ developerSettingsSupported && /* @__PURE__ */ jsx(DeveloperSettingsControl, { deviceId }, deviceId),
3480
3541
  /* @__PURE__ */ jsxs("div", { className: "mt-2", children: [
3481
3542
  /* @__PURE__ */ jsxs("div", { className: "mb-2 flex items-center gap-3 text-[11px]", children: [
3482
3543
  /* @__PURE__ */ jsx("span", { className: "font-medium text-muted-foreground", children: t("drawer.installApp") }),
@@ -3560,18 +3621,8 @@ function DeviceDetailDrawer({ deviceId, onClose }) {
3560
3621
  ] }),
3561
3622
  tab === "overview" && device && deviceId && /* @__PURE__ */ jsxs("section", { children: [
3562
3623
  /* @__PURE__ */ jsx("h3", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2", children: t("drawer.proxy") }),
3563
- /* @__PURE__ */ jsx(
3564
- "button",
3565
- {
3566
- type: "button",
3567
- className: "mb-2 py-2 text-xs text-primary hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary",
3568
- "aria-pressed": manualProxy,
3569
- disabled: proxySaving,
3570
- onClick: () => setManualProxy((value) => !value),
3571
- children: t(manualProxy ? "proxy.chooseManaged" : "proxy.manualInput")
3572
- }
3573
- ),
3574
- /* @__PURE__ */ jsx("div", { hidden: manualProxy, children: /* @__PURE__ */ jsx(
3624
+ proxyCapability.custom && usesAndroidSystemProxy(proxyNode) && /* @__PURE__ */ jsx("p", { className: "mb-2 text-xs text-muted-foreground", children: t("proxy.androidSystemHint") }),
3625
+ /* @__PURE__ */ jsx(Dialog, { open: aixipsOpen, onClose: () => setAixipsOpen(false), title: t("proxy.chooseManaged"), description: t("proxy.regionPurchaseHint"), maxWidth: "max-w-lg", children: aixipsOpen && /* @__PURE__ */ jsx(
3575
3626
  ManagedProxyPanel,
3576
3627
  {
3577
3628
  deviceId,
@@ -3579,29 +3630,31 @@ function DeviceDetailDrawer({ deviceId, onClose }) {
3579
3630
  ownerUserId: device.ownerUserId,
3580
3631
  projectId: device.projectId,
3581
3632
  supported: proxyCapability.managed,
3633
+ regionOnly: true,
3582
3634
  onChanged: () => {
3583
3635
  void fetchDevices();
3584
3636
  void probeProxy(deviceId);
3585
3637
  }
3586
3638
  }
3587
3639
  ) }),
3588
- manualProxy && /* @__PURE__ */ jsxs("div", { className: "mt-3 rounded border border-border p-3", role: "group", "aria-label": t("managed.custom"), children: [
3589
- /* @__PURE__ */ jsx("p", { className: "my-2 text-xs text-muted-foreground", children: t("managed.customHint") }),
3640
+ /* @__PURE__ */ jsxs("div", { className: "rounded border border-border p-3", role: "group", "aria-label": t("managed.custom"), children: [
3590
3641
  /* @__PURE__ */ jsx("p", { className: "text-[11px] text-muted-foreground mb-2", children: t("drawer.proxyDesc") }),
3591
- proxySummary && /* @__PURE__ */ jsxs("p", { className: "mb-2 rounded border border-border/70 bg-secondary/40 px-2 py-1 text-[11px] text-muted-foreground", children: [
3592
- t("drawer.proxyConfigured"),
3593
- ": ",
3594
- /* @__PURE__ */ jsx("code", { children: proxySummary })
3595
- ] }),
3596
3642
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
3597
3643
  /* @__PURE__ */ jsx(
3598
3644
  Input,
3599
3645
  {
3600
3646
  "aria-label": t("managed.custom"),
3601
- disabled: !proxyCapability.custom,
3647
+ disabled: !proxyCapability.custom || proxySaving,
3602
3648
  value: proxyInput,
3603
- onChange: (e) => setProxyInput(e.target.value),
3604
- placeholder: t("drawer.proxyPlaceholder")
3649
+ onChange: (e) => {
3650
+ proxyInputDirtyRef.current = true;
3651
+ setProxyInputDirty(true);
3652
+ setProxyInput(e.target.value);
3653
+ },
3654
+ onBlur: () => {
3655
+ if (proxyInputDirtyRef.current) setProxyInput(normalizeManualProxyUrl(proxyInput));
3656
+ },
3657
+ placeholder: selectedConfigured && !proxySavedAddress ? t("drawer.proxyAddressUnavailable") : t("drawer.proxyPlaceholder")
3605
3658
  }
3606
3659
  ),
3607
3660
  /* @__PURE__ */ jsx(
@@ -3609,12 +3662,32 @@ function DeviceDetailDrawer({ deviceId, onClose }) {
3609
3662
  {
3610
3663
  size: "sm",
3611
3664
  variant: "secondary",
3612
- disabled: proxySaving || !proxyCapability.custom,
3613
- onClick: handleSaveProxy,
3665
+ disabled: proxySaving || proxyAddressLoading || !proxyCapability.custom || !proxyInputDirty,
3666
+ onClick: () => void handleSaveProxy(),
3614
3667
  children: proxySaving ? t("common.saving") : t("common.save")
3615
3668
  }
3669
+ ),
3670
+ selectedConfigured && /* @__PURE__ */ jsx(
3671
+ Button,
3672
+ {
3673
+ size: "sm",
3674
+ variant: "ghost",
3675
+ disabled: proxySaving || proxyAddressLoading || !proxyCapability.custom,
3676
+ onClick: () => void handleSaveProxy(true),
3677
+ children: t("drawer.proxyClear")
3678
+ }
3616
3679
  )
3617
- ] })
3680
+ ] }),
3681
+ /* @__PURE__ */ jsx(
3682
+ "button",
3683
+ {
3684
+ type: "button",
3685
+ className: "mt-2 min-h-11 text-xs text-primary hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary",
3686
+ disabled: proxySaving,
3687
+ onClick: () => setAixipsOpen(true),
3688
+ children: t("proxy.chooseManaged")
3689
+ }
3690
+ )
3618
3691
  ] }),
3619
3692
  !proxyCapability.custom && /* @__PURE__ */ jsx("p", { className: "mt-1 text-[11px] text-warning", children: t("drawer.proxyUnavailable") }),
3620
3693
  proxyApply && /* @__PURE__ */ jsxs("div", { className: "mt-2 rounded border border-border/70 p-2 text-[11px]", children: [
@@ -3845,9 +3918,6 @@ function GpuModeDialog({
3845
3918
  ] })
3846
3919
  ] });
3847
3920
  }
3848
- function maskedProxySummary(summary) {
3849
- return summary.configured ? "http://user:***@host:port" : "";
3850
- }
3851
3921
  function proxyStatusKey(status) {
3852
3922
  switch (status) {
3853
3923
  case "pending":
@@ -4023,6 +4093,147 @@ function TemplateInstallPanel({
4023
4093
  ] })
4024
4094
  ] });
4025
4095
  }
4096
+ function DeveloperSettingsControl({ deviceId }) {
4097
+ const t = useAixT();
4098
+ const client = useClient();
4099
+ const [receipt, setReceipt] = useState(null);
4100
+ const [phase, setPhase] = useState("loading");
4101
+ const [pending, setPending] = useState(false);
4102
+ const [error, setError] = useState("");
4103
+ const [writeUncertain, setWriteUncertain] = useState(false);
4104
+ const inFlight = useRef(false);
4105
+ const active = useRef(true);
4106
+ const refresh = async () => {
4107
+ if (inFlight.current) return;
4108
+ inFlight.current = true;
4109
+ setPhase("loading");
4110
+ setError("");
4111
+ try {
4112
+ const result = await client.devices.getDeveloperSettings(deviceId);
4113
+ if (!active.current) return;
4114
+ if (typeof result?.developerMode !== "boolean" || typeof result?.usbDebugging !== "boolean" || result?.usbAuthorization !== "not_verified") {
4115
+ throw new Error(t("drawer.developerSettingsInvalid"));
4116
+ }
4117
+ setReceipt(result);
4118
+ setWriteUncertain(false);
4119
+ setPhase("ready");
4120
+ } catch (e) {
4121
+ if (!active.current) return;
4122
+ const status = e.status;
4123
+ if (status === 403 || status === 404 || status === 409) setPhase("unsupported");
4124
+ else {
4125
+ setError(e.message);
4126
+ setPhase("error");
4127
+ }
4128
+ } finally {
4129
+ inFlight.current = false;
4130
+ }
4131
+ };
4132
+ useEffect(() => {
4133
+ active.current = true;
4134
+ void refresh();
4135
+ return () => {
4136
+ active.current = false;
4137
+ };
4138
+ }, [deviceId]);
4139
+ const enable = async () => {
4140
+ if (inFlight.current || pending || writeUncertain || phase !== "ready") return;
4141
+ inFlight.current = true;
4142
+ setPending(true);
4143
+ setError("");
4144
+ try {
4145
+ const result = await client.devices.enableDeveloperSettings(deviceId);
4146
+ if (!active.current) return;
4147
+ if (result?.developerMode !== true || result?.usbDebugging !== true || result?.usbAuthorization !== "not_verified") {
4148
+ throw new Error(t("drawer.developerSettingsInvalid"));
4149
+ }
4150
+ setReceipt(result);
4151
+ } catch (e) {
4152
+ if (!active.current) return;
4153
+ setWriteUncertain(true);
4154
+ setError(e.message);
4155
+ } finally {
4156
+ inFlight.current = false;
4157
+ if (active.current) setPending(false);
4158
+ }
4159
+ };
4160
+ if (phase === "unsupported") return null;
4161
+ const enabled = receipt?.developerMode === true && receipt?.usbDebugging === true;
4162
+ return /* @__PURE__ */ jsxs("div", { className: "mt-3 rounded-md border border-border bg-secondary/30 p-3", "aria-busy": phase === "loading" || pending, children: [
4163
+ /* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: t("drawer.developerSettings") }),
4164
+ /* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: t("drawer.developerSettingsHint") }),
4165
+ phase === "loading" ? /* @__PURE__ */ jsx("p", { role: "status", className: "mt-2 text-xs", children: t("drawer.developerSettingsChecking") }) : null,
4166
+ phase === "ready" && enabled ? /* @__PURE__ */ jsx("p", { role: "status", className: "mt-2 text-xs text-foreground", children: t("drawer.developerSettingsEnabled") }) : null,
4167
+ error && /* @__PURE__ */ jsx("p", { role: "alert", className: "mt-2 text-xs text-destructive", children: t("drawer.developerSettingsError", { error }) }),
4168
+ phase === "ready" && !enabled && !writeUncertain && /* @__PURE__ */ jsx(Button, { className: "mt-2 min-h-11", size: "sm", variant: "secondary", disabled: pending, onClick: () => void enable(), children: pending ? t("drawer.developerSettingsEnabling") : t("drawer.developerSettingsEnable") }),
4169
+ (phase === "error" || writeUncertain) && /* @__PURE__ */ jsx(Button, { className: "mt-2 min-h-11", size: "sm", variant: "secondary", disabled: phase === "loading" || pending, onClick: () => void refresh(), children: t("drawer.developerSettingsRefresh") })
4170
+ ] });
4171
+ }
4172
+ function NetworkAdbControl({ deviceId }) {
4173
+ const cfg = useAixConfig();
4174
+ const t = useAixT();
4175
+ const channel = useRef(null);
4176
+ const generation = useRef(0);
4177
+ const [grant, setGrant] = useState({ enabled: false, socketConnected: false });
4178
+ const [busy, setBusy] = useState(false);
4179
+ const [unsupported, setUnsupported] = useState(false);
4180
+ const [error, setError] = useState("");
4181
+ useEffect(() => () => {
4182
+ generation.current++;
4183
+ channel.current?.close();
4184
+ channel.current = null;
4185
+ }, [deviceId]);
4186
+ const toggle = async () => {
4187
+ if (busy) return;
4188
+ setBusy(true);
4189
+ setError("");
4190
+ const token = ++generation.current;
4191
+ try {
4192
+ if (grant.enabled) {
4193
+ const ch = channel.current;
4194
+ channel.current = null;
4195
+ try {
4196
+ await ch?.setNetworkAdb(false);
4197
+ } finally {
4198
+ ch?.close();
4199
+ }
4200
+ if (token === generation.current) setGrant({ enabled: false, socketConnected: false });
4201
+ } else {
4202
+ const ch = channel.current ?? await DeviceChannel.open(cfg, deviceId);
4203
+ if (token !== generation.current) {
4204
+ ch.close();
4205
+ return;
4206
+ }
4207
+ channel.current = ch;
4208
+ ch.on("network_adb", (state) => {
4209
+ if (token === generation.current) setGrant(state);
4210
+ });
4211
+ const receipt = await ch.setNetworkAdb(true);
4212
+ if (token === generation.current && receipt.enabled) setGrant(ch.networkAdbState);
4213
+ }
4214
+ } catch (e) {
4215
+ if (token === generation.current) {
4216
+ channel.current?.close();
4217
+ channel.current = null;
4218
+ setGrant({ enabled: false, socketConnected: false });
4219
+ const message2 = e instanceof Error ? e.message : String(e);
4220
+ if (/unknown.*network_adb|unsupported|unrecognized|unknown.*command|not implemented/i.test(message2)) setUnsupported(true);
4221
+ else setError(message2);
4222
+ }
4223
+ } finally {
4224
+ if (token === generation.current) setBusy(false);
4225
+ }
4226
+ };
4227
+ if (unsupported) return null;
4228
+ return /* @__PURE__ */ jsxs("section", { className: "rounded-md border border-border bg-secondary/30 p-3", "aria-busy": busy, children: [
4229
+ /* @__PURE__ */ jsx("h3", { className: "text-sm font-medium", children: t("drawer.networkAdb") }),
4230
+ /* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: t("drawer.networkAdbHint") }),
4231
+ /* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: t("drawer.rootFridaRuntimeHint") }),
4232
+ /* @__PURE__ */ jsx("p", { role: "status", className: "mt-2 text-xs", children: grant.enabled ? t("drawer.networkAdbGranted") : t("drawer.networkAdbOff") }),
4233
+ error && /* @__PURE__ */ jsx("p", { role: "alert", className: "mt-2 text-xs text-destructive", children: t("drawer.networkAdbError", { error }) }),
4234
+ /* @__PURE__ */ jsx(Button, { size: "sm", variant: "secondary", className: "mt-2 min-h-11", disabled: busy, "aria-pressed": grant.enabled, onClick: () => void toggle(), children: busy ? t("drawer.networkAdbPending") : grant.enabled ? t("drawer.networkAdbDisable") : t("drawer.networkAdbEnable") })
4235
+ ] });
4236
+ }
4026
4237
  var PROFILE_KEYS = {
4027
4238
  balanced: "groupMirror.profile.balanced",
4028
4239
  low_latency: "groupMirror.profile.lowLatency",
@@ -5266,8 +5477,13 @@ function DevicesPage({ taskAgentRunner: providedTaskAgentRunner } = {}) {
5266
5477
  try {
5267
5478
  const settled = await Promise.allSettled(ids.map((id) => client.devices.power(id, action)));
5268
5479
  const failed = settled.filter((r) => r.status === "rejected").length;
5269
- const ok = settled.length - failed;
5270
- if (failed === 0) toast.success(t("devices.bulk.powerDone", { n: ok }));
5480
+ const queued = settled.filter((r) => r.status === "fulfilled" && isQueuedPowerReceipt(r.value)).length;
5481
+ const ok = settled.length - failed - queued;
5482
+ if (queued > 0) {
5483
+ const message2 = t("devices.bulk.powerQueued", { ok, queued, failed });
5484
+ if (failed > 0) toast.error(message2);
5485
+ else toast.info(message2);
5486
+ } else if (failed === 0) toast.success(t("devices.bulk.powerDone", { n: ok }));
5271
5487
  else toast.error(t("devices.bulk.powerPartial", { ok, failed }));
5272
5488
  await fetchDevices();
5273
5489
  } finally {
@@ -24,7 +24,7 @@ function Dialog({
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-[70] 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 max-h-[calc(100dvh-2rem)] overflow-y-auto z-[70] shadow-xl",
28
28
  maxWidth
29
29
  ),
30
30
  children: [
@@ -1,7 +1,7 @@
1
- import { LogConsole } from './chunk-S5N4EOCP.js';
2
- import { cn, Button, Select } from './chunk-VMA3QOYR.js';
3
- import { useDevices, useClient, useScripts, useScriptRun } from './chunk-QEK25NUA.js';
4
- import { variablesToSchema, normalizeDevices, schemaToVariables } from './chunk-7BJPVSEZ.js';
1
+ import { LogConsole } from './chunk-3OBCSW2J.js';
2
+ import { cn, Button, Select } from './chunk-7RQTSTR6.js';
3
+ import { useDevices, useClient, useScripts, useScriptRun } from './chunk-UEZVXYGP.js';
4
+ import { variablesToSchema, normalizeDevices, schemaToVariables } from './chunk-ED6CB3B4.js';
5
5
  import { useMemo, useState, useEffect, useRef, useCallback } from 'react';
6
6
  import { Trash2, Plus, Play, Pause, Square, ArrowDownToLine, WrapText, ChevronRight, Save, XCircle, CheckCircle2, Loader2, Circle } from 'lucide-react';
7
7
  import CodeMirror, { EditorView } from '@uiw/react-codemirror';