@aixnn/aixautots 0.6.8 → 0.6.10

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 (43) hide show
  1. package/dist/{automation-queue-aYRO9JLj.d.ts → automation-queue-CvrWEOw2.d.ts} +2 -2
  2. package/dist/{chunk-PN4J6LSS.js → chunk-5KZB6M2S.js} +4 -3
  3. package/dist/{chunk-IQ2LENG2.js → chunk-7IXBWJHB.js} +13 -4
  4. package/dist/{chunk-WUT5OUBG.js → chunk-LO3XD4T5.js} +20 -4
  5. package/dist/{chunk-4MZSIK34.js → chunk-LR5LJJNM.js} +2 -2
  6. package/dist/{chunk-NUNHJQTB.js → chunk-NEQFR75E.js} +24 -209
  7. package/dist/{chunk-QNDM2SKW.js → chunk-PUEKOYSH.js} +2 -1
  8. package/dist/{chunk-U5A3AUBL.js → chunk-SL6M6CC6.js} +3 -22
  9. package/dist/{chunk-AA6QB6LN.js → chunk-UH5OYPXE.js} +1 -1
  10. package/dist/{chunk-JFSEO3Y4.js → chunk-XCYGBYFC.js} +244 -4
  11. package/dist/chunk-ZB5ET67B.js +22 -0
  12. package/dist/{config-B7t1Ln3w.d.ts → config-BUH2EYHO.d.ts} +1 -1
  13. package/dist/core/index.d.ts +9 -9
  14. package/dist/core/index.js +2 -2
  15. package/dist/{device-normalize-CuGflfZA.d.ts → device-normalize-DzuVemCy.d.ts} +1 -1
  16. package/dist/device-session-7MKEJTIA.js +1 -0
  17. package/dist/i18n/index.js +1 -1
  18. package/dist/{mirror-session-CDPlWFuU.d.ts → mirror-session-D2YY9mKf.d.ts} +1 -1
  19. package/dist/react/index.d.ts +8 -8
  20. package/dist/react/index.js +3 -3
  21. package/dist/{script-debugger-6hoLEwEz.d.ts → script-debugger-Csm4CrfY.d.ts} +1 -1
  22. package/dist/{task-agent-runner-BwRW88rl.d.ts → task-agent-runner-C4WfT77g.d.ts} +6 -3
  23. package/dist/{types-BbtVr3QM.d.ts → types-BfIeUpsU.d.ts} +7 -1
  24. package/dist/ui/billing.d.ts +1 -1
  25. package/dist/ui/billing.js +4 -4
  26. package/dist/ui/device-create.d.ts +1 -1
  27. package/dist/ui/device-create.js +7 -6
  28. package/dist/ui/device-mirror.js +6 -5
  29. package/dist/ui/devices.d.ts +5 -5
  30. package/dist/ui/devices.js +9 -8
  31. package/dist/ui/editor.d.ts +2 -2
  32. package/dist/ui/editor.js +5 -5
  33. package/dist/ui/index.d.ts +5 -5
  34. package/dist/ui/index.js +12 -7
  35. package/dist/ui/inspector.js +4 -4
  36. package/dist/ui/market.js +4 -4
  37. package/dist/ui/mirror.d.ts +3 -3
  38. package/dist/ui/script-studio.js +4 -4
  39. package/dist/ui/scripts.d.ts +1 -1
  40. package/dist/ui/scripts.js +4 -4
  41. package/dist/ui/tasks.js +9 -8
  42. package/package.json +1 -1
  43. package/dist/device-session-XTNY2RSP.js +0 -1
@@ -1,5 +1,5 @@
1
- import { a as RunEventKind, A as AixConfig, R as ResolvedConfig } from './config-B7t1Ln3w.js';
2
- import { S as Script } from './types-BbtVr3QM.js';
1
+ import { a as RunEventKind, A as AixConfig, R as ResolvedConfig } from './config-BUH2EYHO.js';
2
+ import { S as Script } from './types-BfIeUpsU.js';
3
3
 
4
4
  interface FlowSubmit {
5
5
  /** Inline flow JSON (XOR scriptId). */
@@ -1,7 +1,8 @@
1
- import { canConnectPhysicalDevice, IosDeviceDiagnostics } from './chunk-U5A3AUBL.js';
2
- import { useAixT } from './chunk-WUT5OUBG.js';
1
+ import { IosDeviceDiagnostics } from './chunk-SL6M6CC6.js';
2
+ import { canConnectPhysicalDevice } from './chunk-ZB5ET67B.js';
3
+ import { useAixT } from './chunk-LO3XD4T5.js';
3
4
  import { cn, Select, Dialog, Button, Input, Badge } from './chunk-SKTL6ACT.js';
4
- import { useNodes, useClient, useDevices } from './chunk-IQ2LENG2.js';
5
+ import { useNodes, useClient, useDevices } from './chunk-7IXBWJHB.js';
5
6
  import { useMemo, useEffect, useState, useCallback, useRef } from 'react';
6
7
  import { Server, RefreshCw, Smartphone, Usb, Wifi, Info } from 'lucide-react';
7
8
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
@@ -1,5 +1,5 @@
1
- import { DeviceChannel, ScriptDebugger, FlowRun, MirrorSession, normalizeDevices, submitBatch } from './chunk-AA6QB6LN.js';
2
- import { resolveConfig, AixClient, isFleetRunTerminal, joinUrl, AixAuthError, AixError, EnvRun, detectEnvOs, summarizeEnv, ReconnectingSocket, executionWsTicketUrl } from './chunk-QNDM2SKW.js';
1
+ import { DeviceChannel, ScriptDebugger, FlowRun, MirrorSession, normalizeDevices, submitBatch } from './chunk-UH5OYPXE.js';
2
+ import { resolveConfig, AixClient, isFleetRunTerminal, joinUrl, AixAuthError, AixError, EnvRun, detectEnvOs, summarizeEnv, ReconnectingSocket, executionWsTicketUrl } from './chunk-PUEKOYSH.js';
3
3
  import React, { createContext, useContext, useState, useRef, useEffect, useCallback, useMemo, createElement } from 'react';
4
4
  import { jsx } from 'react/jsx-runtime';
5
5
 
@@ -440,6 +440,8 @@ function mapDevice(r) {
440
440
  status: online ? "connected" : booting ? "connecting" : "disconnected",
441
441
  udid: r.external_id,
442
442
  online,
443
+ controlSessionOpen: r.control_session_open,
444
+ recoveryRequired: r.recovery_required,
443
445
  meta,
444
446
  tags: r.tags ?? [],
445
447
  note: r.note ?? "",
@@ -2163,6 +2165,9 @@ function useEnvGate(nodeId, opts) {
2163
2165
  }
2164
2166
  setProbing(true);
2165
2167
  setError(null);
2168
+ setNeedsSetup(null);
2169
+ setReady(false);
2170
+ setOpen(false);
2166
2171
  try {
2167
2172
  const run = await EnvRun.start(cfg, nodeId, "status", { os });
2168
2173
  const events = [];
@@ -2172,9 +2177,13 @@ function useEnvGate(nodeId, opts) {
2172
2177
  const sum = summarizeEnv(events);
2173
2178
  setStatusEvents(events);
2174
2179
  setReady(sum.ready);
2175
- setNeedsSetup(!sum.ready);
2180
+ const missing = !sum.ready && !!sum.finished && !sum.finished.code && sum.steps.some((step) => step.state === "missing") && !sum.steps.some((step) => step.state === "failed" || step.state === "error");
2181
+ setNeedsSetup(sum.ready ? false : missing ? true : null);
2176
2182
  setProbing(false);
2177
- if (!sum.ready && autoOpen) setOpen(true);
2183
+ if (!sum.ready && !missing) {
2184
+ setError(new Error(sum.finished?.error || "Environment status could not be verified"));
2185
+ }
2186
+ if (missing && autoOpen) setOpen(true);
2178
2187
  });
2179
2188
  } catch (e) {
2180
2189
  if (!mounted.current) return;
@@ -5,7 +5,15 @@ import { createContext, useMemo, createElement, useContext } from 'react';
5
5
  // src/ui/i18n/dict.ts
6
6
  var en = {
7
7
  "deviceConnect.title": "Connect selected devices",
8
- "deviceConnect.description": "Reconnect paired Android network devices. USB entries only refresh reported inventory; restore their USB connection on the host. Use Add device for iOS pairing.",
8
+ "deviceConnect.recoveryRequested": "Recovery request completed for the original cloud device. Its control session may resume billing; refresh status and open the mirror to verify the connection.",
9
+ "deviceConnect.managedNodeMissing": "The original cloud-device node is missing. Recovery cannot select or move to another node.",
10
+ "deviceConnect.managedPermission": "Enable Android virtual-device access on the original node.",
11
+ "deviceConnect.recoveryRequired": "Recovery needed",
12
+ "deviceConnect.sessionClosed": "Control session closed \u2014 use Connect to recover.",
13
+ "deviceConnect.recoveryExplanation": "Recovery checks the original cloud instance and may resume session billing. A successful request does not confirm video readiness.",
14
+ "deviceConnect.refreshStatus": "Refresh status",
15
+ "deviceConnect.recoveryHint": "Select this device and use Connect to restore its control session.",
16
+ "deviceConnect.description": "Recover managed cloud devices on their original nodes (this may resume session billing), or reconnect paired Android network devices. USB only refreshes inventory; use Add device for iOS pairing.",
9
17
  "deviceConnect.chooseFor": "Choose the node attached to {name}",
10
18
  "deviceConnect.chooseNode": "Choose an owned online node",
11
19
  "deviceConnect.noNodes": "No eligible owned online node. Start your node and enable physical-device access.",
@@ -22,7 +30,7 @@ var en = {
22
30
  "deviceConnect.invalidAddress": "Invalid wireless address. Use host:port or [IPv6]:port through Add device.",
23
31
  "deviceConnect.nodeMissing": "Original node is missing. Restore it, or use Add device to set up the target node explicitly.",
24
32
  "deviceConnect.nodeOffline": "Original node is offline. Start it and try again.",
25
- "deviceConnect.notOwner": "Physical-device connections require a node you own.",
33
+ "deviceConnect.notOwner": "Connection requests require a node you own.",
26
34
  "deviceConnect.permission": "Enable this platform and physical-device access on the selected node.",
27
35
  "deviceConnect.notReported": "Not reported by this node. Check the USB cable/driver, or wireless pairing and address, then use Add device.",
28
36
  "deviceConnect.unauthorized": "Device is offline or unauthorized. Unlock it and approve USB debugging/trust, or pair it through Add device.",
@@ -877,7 +885,15 @@ var en = {
877
885
  };
878
886
  var zh = {
879
887
  "deviceConnect.title": "\u8FDE\u63A5\u6240\u9009\u8BBE\u5907",
880
- "deviceConnect.description": "\u91CD\u8FDE\u5DF2\u914D\u5BF9\u7684 Android \u7F51\u7EDC\u8BBE\u5907\u3002USB \u8BBE\u5907\u4EC5\u5237\u65B0\u5DF2\u4E0A\u62A5\u8BB0\u5F55\uFF0C\u8BF7\u5728\u5BBF\u4E3B\u6062\u590D USB \u8FDE\u63A5\uFF1BiOS \u914D\u5BF9\u8BF7\u4F7F\u7528\u6DFB\u52A0\u8BBE\u5907\u3002",
888
+ "deviceConnect.recoveryRequested": "\u539F\u4E91\u8BBE\u5907\u6062\u590D\u8BF7\u6C42\u5DF2\u5B8C\u6210\uFF0C\u63A7\u5236\u4F1A\u8BDD\u53EF\u80FD\u6062\u590D\u8BA1\u8D39\uFF1B\u8BF7\u5237\u65B0\u72B6\u6001\u5E76\u6253\u5F00\u955C\u50CF\u9A8C\u8BC1\u8FDE\u63A5\u3002",
889
+ "deviceConnect.managedNodeMissing": "\u539F\u4E91\u8BBE\u5907\u8282\u70B9\u7F3A\u5931\uFF0C\u6062\u590D\u4E0D\u80FD\u53E6\u9009\u8282\u70B9\u6216\u8FC1\u79FB\u8BBE\u5907\u3002",
890
+ "deviceConnect.managedPermission": "\u8BF7\u5728\u539F\u8282\u70B9\u542F\u7528 Android \u865A\u62DF\u8BBE\u5907\u6743\u9650\u3002",
891
+ "deviceConnect.recoveryRequired": "\u9700\u8981\u6062\u590D",
892
+ "deviceConnect.sessionClosed": "\u63A7\u5236\u4F1A\u8BDD\u5DF2\u5173\u95ED\uFF0C\u8BF7\u70B9\u51FB\u8FDE\u63A5\u6062\u590D\u3002",
893
+ "deviceConnect.recoveryExplanation": "\u6062\u590D\u4F1A\u6838\u5BF9\u539F\u4E91\u8BBE\u5907\uFF0C\u53EF\u80FD\u6062\u590D\u4F1A\u8BDD\u8BA1\u8D39\uFF1B\u8BF7\u6C42\u6210\u529F\u4E0D\u4EE3\u8868\u753B\u9762\u5DF2\u5C31\u7EEA\u3002",
894
+ "deviceConnect.refreshStatus": "\u5237\u65B0\u72B6\u6001",
895
+ "deviceConnect.recoveryHint": "\u8BF7\u9009\u62E9\u6B64\u8BBE\u5907\u5E76\u70B9\u51FB\u8FDE\u63A5\uFF0C\u6062\u590D\u5176\u63A7\u5236\u4F1A\u8BDD\u3002",
896
+ "deviceConnect.description": "\u5728\u539F\u8282\u70B9\u6062\u590D\u6258\u7BA1\u4E91\u8BBE\u5907\uFF08\u53EF\u80FD\u6062\u590D\u4F1A\u8BDD\u8BA1\u8D39\uFF09\uFF0C\u6216\u91CD\u8FDE\u5DF2\u914D\u5BF9\u7684 Android \u7F51\u7EDC\u8BBE\u5907\u3002USB \u4EC5\u5237\u65B0\u4E0A\u62A5\u8BB0\u5F55\uFF1BiOS \u914D\u5BF9\u8BF7\u4F7F\u7528\u6DFB\u52A0\u8BBE\u5907\u3002",
881
897
  "deviceConnect.chooseFor": "\u4E3A {name} \u9009\u62E9\u5B9E\u9645\u63A5\u5165\u7684\u8282\u70B9",
882
898
  "deviceConnect.chooseNode": "\u9009\u62E9\u672C\u4EBA\u5728\u7EBF\u8282\u70B9",
883
899
  "deviceConnect.noNodes": "\u6CA1\u6709\u53EF\u7528\u7684\u672C\u4EBA\u5728\u7EBF\u8282\u70B9\uFF0C\u8BF7\u542F\u52A8\u8282\u70B9\u5E76\u542F\u7528\u5BF9\u5E94\u771F\u673A\u6743\u9650\u3002",
@@ -894,7 +910,7 @@ var zh = {
894
910
  "deviceConnect.invalidAddress": "\u65E0\u7EBF\u5730\u5740\u65E0\u6548\uFF0C\u8BF7\u901A\u8FC7\u6DFB\u52A0\u8BBE\u5907\u586B\u5199 \u4E3B\u673A:\u7AEF\u53E3 \u6216 [IPv6]:\u7AEF\u53E3\u3002",
895
911
  "deviceConnect.nodeMissing": "\u539F\u8282\u70B9\u4E0D\u5B58\u5728\uFF0C\u8BF7\u6062\u590D\u539F\u8282\u70B9\uFF0C\u6216\u901A\u8FC7\u6DFB\u52A0\u8BBE\u5907\u660E\u786E\u914D\u7F6E\u76EE\u6807\u8282\u70B9\u3002",
896
912
  "deviceConnect.nodeOffline": "\u539F\u8282\u70B9\u79BB\u7EBF\uFF0C\u8BF7\u5148\u542F\u52A8\u540E\u91CD\u8BD5\u3002",
897
- "deviceConnect.notOwner": "\u771F\u673A\u8FDE\u63A5\u53EA\u80FD\u5728\u672C\u4EBA\u8282\u70B9\u6267\u884C\u3002",
913
+ "deviceConnect.notOwner": "\u8FDE\u63A5\u8BF7\u6C42\u53EA\u80FD\u5728\u672C\u4EBA\u8282\u70B9\u6267\u884C\u3002",
898
914
  "deviceConnect.permission": "\u8BF7\u4E3A\u6240\u9009\u8282\u70B9\u542F\u7528\u5BF9\u5E94\u5E73\u53F0\u53CA\u771F\u673A\u63A5\u5165\u6743\u9650\u3002",
899
915
  "deviceConnect.notReported": "\u6B64\u8282\u70B9\u5C1A\u672A\u53D1\u73B0\u8BBE\u5907\uFF0C\u8BF7\u68C0\u67E5 USB \u7EBF\u7F06/\u9A71\u52A8\uFF0C\u6216\u65E0\u7EBF\u914D\u5BF9\u4E0E\u5730\u5740\uFF0C\u518D\u901A\u8FC7\u6DFB\u52A0\u8BBE\u5907\u914D\u7F6E\u3002",
900
916
  "deviceConnect.unauthorized": "\u8BBE\u5907\u79BB\u7EBF\u6216\u672A\u6388\u6743\uFF0C\u8BF7\u89E3\u9501\u5E76\u786E\u8BA4 USB \u8C03\u8BD5/\u4FE1\u4EFB\u63D0\u793A\uFF0C\u6216\u901A\u8FC7\u6DFB\u52A0\u8BBE\u5907\u914D\u5BF9\u3002",
@@ -1,7 +1,7 @@
1
1
  import { LogConsole } from './chunk-D7J4EQTA.js';
2
2
  import { cn, Button, Select } from './chunk-SKTL6ACT.js';
3
- import { useDevices, useClient, useScripts, useScriptRun } from './chunk-IQ2LENG2.js';
4
- import { variablesToSchema, normalizeDevices, schemaToVariables } from './chunk-AA6QB6LN.js';
3
+ import { useDevices, useClient, useScripts, useScriptRun } from './chunk-7IXBWJHB.js';
4
+ import { variablesToSchema, normalizeDevices, schemaToVariables } from './chunk-UH5OYPXE.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';
@@ -1,12 +1,13 @@
1
1
  import { LogConsole } from './chunk-D7J4EQTA.js';
2
- import { requestPreviewFrame, MirrorSurface, DeviceMirror } from './chunk-JFSEO3Y4.js';
2
+ import { requestPreviewFrame, MirrorSurface, DeviceMirror, ConnectDevicesDialog } from './chunk-XCYGBYFC.js';
3
3
  import { ControlBar, MirrorView } from './chunk-E7WMHM63.js';
4
- import { deviceProxyCapabilities, createProxyProbeGuard, proxySummaryFromDevice, isProxyApplyStatus, proxyCapabilityReason, proxyProbeExitIp, proxyProbeMessage, DeviceCreate, isProxyProbeUnsupported, isRedactedProxyUrl, isSupportedProxyUrl, redactProxyUrl } from './chunk-PN4J6LSS.js';
5
- import { isPhysicalIos, IosDeviceDiagnostics, canConnectPhysicalDevice } from './chunk-U5A3AUBL.js';
6
- import { useAixT, useAixLang } from './chunk-WUT5OUBG.js';
4
+ import { deviceProxyCapabilities, createProxyProbeGuard, proxySummaryFromDevice, isProxyApplyStatus, proxyCapabilityReason, proxyProbeExitIp, proxyProbeMessage, DeviceCreate, isProxyProbeUnsupported, isRedactedProxyUrl, isSupportedProxyUrl, redactProxyUrl } from './chunk-5KZB6M2S.js';
5
+ import { IosDeviceDiagnostics } from './chunk-SL6M6CC6.js';
6
+ import { isPhysicalIos } from './chunk-ZB5ET67B.js';
7
+ import { useAixT, useAixLang } from './chunk-LO3XD4T5.js';
7
8
  import { cn, Badge, Button, Dialog, Input, Popover, Select, useToast, ToastViewport, Drawer } from './chunk-SKTL6ACT.js';
8
- import { useClient, useDevicesView, useShortcutsView, GROUP_MIRROR_MAX, useGroupMirror, useScripts, useFleetRun, useTaskAgentRun, preflightTaskAgentDevice, createAgentTaskRunner, useNodesView } from './chunk-IQ2LENG2.js';
9
- import { DeviceSession, pushFile, pullFile } from './chunk-QNDM2SKW.js';
9
+ import { useClient, useDevicesView, useShortcutsView, GROUP_MIRROR_MAX, useGroupMirror, useScripts, useFleetRun, useTaskAgentRun, preflightTaskAgentDevice, createAgentTaskRunner, useNodesView } from './chunk-7IXBWJHB.js';
10
+ import { DeviceSession, pushFile, pullFile } from './chunk-PUEKOYSH.js';
10
11
  import { useState, useRef, useCallback, useEffect, useMemo, useLayoutEffect } from 'react';
11
12
  import * as Icons from 'lucide-react';
12
13
  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';
@@ -56,7 +57,7 @@ function DeviceCard({
56
57
  tint: "bg-muted"
57
58
  }
58
59
  };
59
- const status = statusMeta[device.status];
60
+ const status = device.recoveryRequired === true ? statusMeta.disconnected : statusMeta[device.status];
60
61
  const provisioned = device.meta.provisioned === true;
61
62
  const offlineVirtual = !device.online && device.status !== "connecting" && provisioned;
62
63
  const sleeping = device.meta.sleeping === true;
@@ -132,7 +133,7 @@ function DeviceCard({
132
133
  className: "absolute left-3 top-3 z-10 h-4 w-4 cursor-pointer rounded border-input bg-card/80 accent-primary"
133
134
  }
134
135
  ),
135
- /* @__PURE__ */ jsx("div", { className: "absolute right-3 top-3 z-10", children: /* @__PURE__ */ jsxs(
136
+ /* @__PURE__ */ jsx("div", { className: "absolute right-3 top-3 z-10", title: device.recoveryRequired === true ? t("deviceConnect.recoveryHint") : void 0, children: /* @__PURE__ */ jsxs(
136
137
  "div",
137
138
  {
138
139
  className: cn(
@@ -141,7 +142,7 @@ function DeviceCard({
141
142
  ),
142
143
  children: [
143
144
  /* @__PURE__ */ jsx("span", { className: cn("h-1.5 w-1.5 rounded-full", status.dot) }),
144
- /* @__PURE__ */ jsx("span", { className: cn("text-[10px] font-bold tracking-wide", status.text), children: status.label })
145
+ /* @__PURE__ */ jsx("span", { className: cn("text-[10px] font-bold tracking-wide", status.text), children: device.recoveryRequired === true ? t("deviceConnect.recoveryRequired") : status.label })
145
146
  ]
146
147
  }
147
148
  ) }),
@@ -5153,195 +5154,6 @@ function DeviceEditDialog({ device, onClose }) {
5153
5154
  }
5154
5155
  );
5155
5156
  }
5156
-
5157
- // src/ui/devices/device-connect.ts
5158
- function adbAddress(serial) {
5159
- const value = serial.trim();
5160
- const match = /^(\[[^\]]+\]|[^:\[\]\/\?#@\s]+):([0-9]{1,5})$/.exec(value);
5161
- if (!match || Number(match[2]) < 1 || Number(match[2]) > 65535) return null;
5162
- try {
5163
- const parsed = new URL(`http://${value}`);
5164
- if (!parsed.hostname || parsed.username || parsed.password || parsed.search || parsed.hash) return null;
5165
- return value;
5166
- } catch {
5167
- return null;
5168
- }
5169
- }
5170
- function connectionMode(device) {
5171
- if (device.meta.provisioned === true || device.id.startsWith("rd-") || device.id.startsWith("vp-")) return { kind: "blocked", code: "virtual" };
5172
- if (device.platform === "macos" || device.platform === "windows") return { kind: "blocked", code: "desktop" };
5173
- if (device.platform !== "android") return { kind: "blocked", code: "unsupported" };
5174
- if (device.platform === "android") {
5175
- const address = adbAddress(device.udid);
5176
- if (address) return { kind: "wireless", address };
5177
- if (device.udid.includes(":")) return { kind: "blocked", code: "invalidAddress" };
5178
- }
5179
- return { kind: "inventory" };
5180
- }
5181
- function eligibleConnectionNodes(nodes, device) {
5182
- return nodes.filter((node) => canConnectPhysicalDevice(node, device.platform === "android" ? "android" : "ios") && (device.platform !== "android" || node.effective_caps?.android !== false));
5183
- }
5184
- async function connectSelectedDevices(client, devices, choices = {}, isCurrent = () => true) {
5185
- const result = (device, code, error) => ({
5186
- id: device.id,
5187
- name: device.name,
5188
- ok: code === "requested" || code === "alreadyOnline",
5189
- code,
5190
- ...error ? { error } : {}
5191
- });
5192
- if (!devices.length) return [];
5193
- let nodes;
5194
- try {
5195
- nodes = await client.nodes.list();
5196
- } catch (error) {
5197
- return devices.map((device) => result(device, "requestFailed", String(error.message ?? error)));
5198
- }
5199
- const results = [];
5200
- for (const device of devices) {
5201
- if (!isCurrent()) {
5202
- results.push(result(device, "cancelled"));
5203
- continue;
5204
- }
5205
- if (device.online) {
5206
- results.push(result(device, "alreadyOnline"));
5207
- continue;
5208
- }
5209
- const mode = connectionMode(device);
5210
- if (mode.kind === "blocked") {
5211
- results.push(result(device, mode.code));
5212
- continue;
5213
- }
5214
- const nodeId = device.nodeId ?? choices[device.id];
5215
- if (!nodeId) {
5216
- results.push(result(device, "chooseNode"));
5217
- continue;
5218
- }
5219
- const node = nodes.find((candidate) => candidate.id === nodeId);
5220
- if (!node) {
5221
- results.push(result(device, "nodeMissing"));
5222
- continue;
5223
- }
5224
- if (!node.is_owner) {
5225
- results.push(result(device, "notOwner"));
5226
- continue;
5227
- }
5228
- if (node.status !== "online") {
5229
- results.push(result(device, "nodeOffline"));
5230
- continue;
5231
- }
5232
- if (!eligibleConnectionNodes([node], device).length) {
5233
- results.push(result(device, "permission"));
5234
- continue;
5235
- }
5236
- let requested = false;
5237
- try {
5238
- if (mode.kind === "wireless") {
5239
- await client.nodes.adbConnect(node.id, mode.address);
5240
- requested = true;
5241
- if (!isCurrent()) {
5242
- results.push(result(device, "cancelled"));
5243
- continue;
5244
- }
5245
- }
5246
- await client.nodes.discoverDevices(node.id);
5247
- if (!isCurrent()) {
5248
- results.push(result(device, "cancelled"));
5249
- continue;
5250
- }
5251
- results.push(result(device, requested ? "requested" : "inventoryOnly"));
5252
- } catch (error) {
5253
- results.push(result(device, requested ? "refreshFailed" : "requestFailed", String(error.message ?? error)));
5254
- }
5255
- }
5256
- return results;
5257
- }
5258
- function ConnectDevicesDialog({ devices, onClose, onComplete }) {
5259
- const client = useClient();
5260
- const t = useAixT();
5261
- const [nodes, setNodes] = useState([]);
5262
- const [choices, setChoices] = useState({});
5263
- const [loading, setLoading] = useState(false);
5264
- const [busy, setBusy] = useState(false);
5265
- const [error, setError] = useState("");
5266
- const [results, setResults] = useState(null);
5267
- const active = useRef(true);
5268
- const pending = useRef(false);
5269
- const unassigned = devices.filter((device) => !device.online && !device.nodeId && connectionMode(device).kind !== "blocked");
5270
- const needsChoice = unassigned.some((device) => !choices[device.id]);
5271
- const run = async () => {
5272
- if (!active.current || pending.current || needsChoice) return;
5273
- pending.current = true;
5274
- setBusy(true);
5275
- setError("");
5276
- try {
5277
- const next = await connectSelectedDevices(client, devices, choices, () => active.current);
5278
- if (!active.current) return;
5279
- setResults(next);
5280
- await onComplete(next);
5281
- } catch (error2) {
5282
- if (active.current) setError(error2.message);
5283
- } finally {
5284
- pending.current = false;
5285
- if (active.current) setBusy(false);
5286
- }
5287
- };
5288
- useEffect(() => {
5289
- active.current = true;
5290
- if (unassigned.length) {
5291
- setLoading(true);
5292
- void client.nodes.list().then((rows) => {
5293
- if (active.current) setNodes(rows);
5294
- }).catch((error2) => {
5295
- if (active.current) setError(error2.message);
5296
- }).finally(() => {
5297
- if (active.current) setLoading(false);
5298
- });
5299
- } else {
5300
- void run();
5301
- }
5302
- return () => {
5303
- active.current = false;
5304
- };
5305
- }, []);
5306
- return /* @__PURE__ */ jsx(Dialog, { open: true, onClose, title: t("deviceConnect.title"), description: t("deviceConnect.description"), children: /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
5307
- unassigned.map((device) => {
5308
- const available = eligibleConnectionNodes(nodes, device);
5309
- return /* @__PURE__ */ jsxs("div", { children: [
5310
- /* @__PURE__ */ jsxs("label", { className: "block text-xs font-medium", children: [
5311
- /* @__PURE__ */ jsx("span", { className: "mb-1 block", children: t("deviceConnect.chooseFor", { name: device.name }) }),
5312
- /* @__PURE__ */ jsx(
5313
- Select,
5314
- {
5315
- value: choices[device.id] ?? "",
5316
- disabled: busy || loading,
5317
- onChange: (nodeId) => setChoices((previous) => ({ ...previous, [device.id]: nodeId })),
5318
- placeholder: t("deviceConnect.chooseNode"),
5319
- options: available.map((node) => ({ value: node.id, label: node.name }))
5320
- }
5321
- )
5322
- ] }),
5323
- !loading && !available.length && /* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: t("deviceConnect.noNodes") })
5324
- ] }, device.id);
5325
- }),
5326
- loading && /* @__PURE__ */ jsx("p", { role: "status", className: "text-xs", children: t("deviceConnect.loading") }),
5327
- busy && /* @__PURE__ */ jsx("p", { role: "status", className: "text-xs", children: t("deviceConnect.running") }),
5328
- error && /* @__PURE__ */ jsx("p", { role: "alert", className: "text-xs text-destructive", children: error }),
5329
- results && /* @__PURE__ */ jsx("ul", { className: "max-h-64 space-y-2 overflow-auto", "aria-live": "polite", children: results.map((result) => /* @__PURE__ */ jsxs("li", { className: "text-xs", children: [
5330
- /* @__PURE__ */ jsxs("span", { className: "font-medium", children: [
5331
- result.name,
5332
- ": "
5333
- ] }),
5334
- /* @__PURE__ */ jsxs("span", { className: result.ok ? "text-muted-foreground" : "text-destructive", children: [
5335
- t(`deviceConnect.${result.code}`),
5336
- result.error ? ` ${result.error}` : ""
5337
- ] })
5338
- ] }, result.id)) }),
5339
- /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
5340
- /* @__PURE__ */ jsx(Button, { size: "sm", variant: "ghost", onClick: onClose, children: t("common.close") }),
5341
- !results && unassigned.length > 0 && /* @__PURE__ */ jsx(Button, { size: "sm", disabled: busy || loading || needsChoice, onClick: () => void run(), children: busy ? t("deviceConnect.running") : t("devices.bulk.connect") })
5342
- ] })
5343
- ] }) });
5344
- }
5345
5157
  function DevicesPage({ taskAgentRunner: providedTaskAgentRunner } = {}) {
5346
5158
  const t = useAixT();
5347
5159
  const client = useClient();
@@ -6125,17 +5937,20 @@ function DeviceRow({
6125
5937
  }
6126
5938
  ),
6127
5939
  /* @__PURE__ */ jsx("span", { className: cn("h-2 w-2 shrink-0 rounded-full", ROW_DOT[device.status]) }),
6128
- /* @__PURE__ */ jsx("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsxs("p", { className: "truncate text-body-sm font-medium text-foreground", children: [
6129
- device.name,
6130
- device.note ? /* @__PURE__ */ jsxs("span", { className: "ml-1 font-normal text-muted-foreground", children: [
6131
- "\xB7 ",
6132
- device.note
6133
- ] }) : null,
6134
- device.tags.length > 0 ? /* @__PURE__ */ jsxs("span", { className: "ml-1 text-[11px] font-normal text-muted-foreground", children: [
6135
- "\xB7 ",
6136
- device.tags.join(" / ")
6137
- ] }) : null
6138
- ] }) }),
5940
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
5941
+ /* @__PURE__ */ jsxs("p", { className: "truncate text-body-sm font-medium text-foreground", children: [
5942
+ device.name,
5943
+ device.note ? /* @__PURE__ */ jsxs("span", { className: "ml-1 font-normal text-muted-foreground", children: [
5944
+ "\xB7 ",
5945
+ device.note
5946
+ ] }) : null,
5947
+ device.tags.length > 0 ? /* @__PURE__ */ jsxs("span", { className: "ml-1 text-[11px] font-normal text-muted-foreground", children: [
5948
+ "\xB7 ",
5949
+ device.tags.join(" / ")
5950
+ ] }) : null
5951
+ ] }),
5952
+ device.recoveryRequired === true && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", title: t("deviceConnect.recoveryHint"), children: t("deviceConnect.recoveryRequired") })
5953
+ ] }),
6139
5954
  /* @__PURE__ */ jsx(
6140
5955
  "button",
6141
5956
  {
@@ -787,6 +787,7 @@ var EnvRun = class _EnvRun {
787
787
  currentRun.onMessage(JSON.stringify({
788
788
  kind: "finished",
789
789
  ok: false,
790
+ code: "ENV_PROGRESS_CONNECTION_FAILED",
790
791
  error: `Environment progress connection failed: ${String(error)}`,
791
792
  hint: "The node may still be installing. Check its status before starting setup again."
792
793
  }));
@@ -1686,7 +1687,7 @@ var AixClient = class {
1686
1687
  * 即可,不必回依赖 client 实例)。
1687
1688
  */
1688
1689
  async deviceSession(deviceId, opts = {}) {
1689
- const { DeviceSession: DeviceSession2 } = await import('./device-session-XTNY2RSP.js');
1690
+ const { DeviceSession: DeviceSession2 } = await import('./device-session-7MKEJTIA.js');
1690
1691
  return DeviceSession2.open(this.cfg, deviceId, opts);
1691
1692
  }
1692
1693
  };
@@ -1,6 +1,6 @@
1
- import { useAixT } from './chunk-WUT5OUBG.js';
1
+ import { useAixT } from './chunk-LO3XD4T5.js';
2
2
  import { Button } from './chunk-SKTL6ACT.js';
3
- import { useClient } from './chunk-IQ2LENG2.js';
3
+ import { useClient } from './chunk-7IXBWJHB.js';
4
4
  import { useSyncExternalStore, useState, useEffect } from 'react';
5
5
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
6
6
 
@@ -80,23 +80,4 @@ function IosDeviceDiagnostics({ nodeId, udid }) {
80
80
  ] });
81
81
  }
82
82
 
83
- // src/ui/device-capabilities.ts
84
- function isPhysicalIos(device) {
85
- const meta = device.meta ?? {};
86
- const spec = meta.spec;
87
- const platform = meta.platform ?? spec?.platform ?? device.platform;
88
- return device.id?.startsWith("ios-") === true || meta.kind === "ios-real" || platform === "ios-real" || ["ios", "vphone"].includes(String(platform)) && meta.provisioned !== true;
89
- }
90
- function iosPhysicalUnavailableReason(node) {
91
- const os = node.reported_caps?.system?.os;
92
- if (os !== "macos" && os !== "windows") return "iOS \u771F\u673A\u9700 Windows/macOS \u5BBF\u4E3B\uFF08\u7ECF go-ios \u9A71\u52A8\uFF09";
93
- if (node.reported_caps?.ios_capable !== true) return "\u8282\u70B9\u5C1A\u672A\u4E0A\u62A5 iOS \u771F\u673A\u80FD\u529B\uFF0C\u8BF7\u68C0\u67E5\u8282\u70B9\u7248\u672C\u4E0E\u8FD0\u884C\u73AF\u5883";
94
- if (node.effective_caps?.real_devices !== true) return "\u8282\u70B9\u672A\u542F\u7528\u771F\u673A\u63A5\u5165";
95
- if (node.effective_caps?.ios !== true) return "\u8282\u70B9\u672A\u542F\u7528 iOS \u8BBE\u5907\u6743\u9650";
96
- return null;
97
- }
98
- function canConnectPhysicalDevice(node, platform) {
99
- return node.is_owner && node.status === "online" && (platform === "ios" ? iosPhysicalUnavailableReason(node) === null : node.effective_caps?.real_devices === true);
100
- }
101
-
102
- export { IosDeviceDiagnostics, canConnectPhysicalDevice, iosPhysicalUnavailableReason, isPhysicalIos };
83
+ export { IosDeviceDiagnostics };
@@ -1,4 +1,4 @@
1
- import { joinUrl, AixAuthError, AixLocked, AixError, resolveConfig, ReconnectingSocket, AixTimeout, parseIncoming, isRetFrame, errorFromRet, isFridaEventFrame, isScriptletEventFrame, isStatusFrame, executionWsTicketUrl, isExecutionFrame, getIceServers, mintViewerToken, executionStreamEventsAfter } from './chunk-QNDM2SKW.js';
1
+ import { joinUrl, AixAuthError, AixLocked, AixError, resolveConfig, ReconnectingSocket, AixTimeout, parseIncoming, isRetFrame, errorFromRet, isFridaEventFrame, isScriptletEventFrame, isStatusFrame, executionWsTicketUrl, isExecutionFrame, getIceServers, mintViewerToken, executionStreamEventsAfter } from './chunk-PUEKOYSH.js';
2
2
 
3
3
  // src/core/ws-access.ts
4
4
  async function mintDeviceAccess(cfg, deviceId) {