@aixnn/aixautots 0.5.4 → 0.6.1

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 (44) hide show
  1. package/README.md +40 -23
  2. package/dist/{automation-queue-CKsueO9z.d.ts → automation-queue-BxrSIkG3.d.ts} +1 -1
  3. package/dist/{chunk-XNKC6HU3.js → chunk-6S3XLY5O.js} +3 -3
  4. package/dist/{chunk-UINEPEIE.js → chunk-A5VNENHD.js} +18 -6
  5. package/dist/{chunk-TATL3HTE.js → chunk-B2BOVLI6.js} +82 -21
  6. package/dist/{chunk-V4MXFPDX.js → chunk-BUW45GM2.js} +3 -3
  7. package/dist/{chunk-CVV7FOMQ.js → chunk-E7WMHM63.js} +10 -1
  8. package/dist/{chunk-OXIM6EYO.js → chunk-JTFZSFFA.js} +1 -1
  9. package/dist/{chunk-IJVNII5N.js → chunk-LAZ3RQ7X.js} +1 -1
  10. package/dist/{chunk-SVK2AY3J.js → chunk-M7CKUC4U.js} +49 -12
  11. package/dist/{chunk-BSHHYM72.js → chunk-P2Y655SL.js} +19 -8
  12. package/dist/{chunk-O34SNDQB.js → chunk-Q63FQ7B5.js} +4 -4
  13. package/dist/{chunk-64Q7BBIQ.js → chunk-T3QVYTOT.js} +10 -0
  14. package/dist/{chunk-YOT7HZBU.js → chunk-VKPKHUHU.js} +59 -16
  15. package/dist/{config-fsx4jlLK.d.ts → config-CLi5IhmO.d.ts} +6 -4
  16. package/dist/core/index.d.ts +6 -6
  17. package/dist/core/index.js +4 -4
  18. package/dist/device-session-CVT7OY4H.js +2 -0
  19. package/dist/i18n/index.js +1 -1
  20. package/dist/{mirror-session-DM-trg1F.d.ts → mirror-session-BP7Rd3Jk.d.ts} +4 -1
  21. package/dist/react/index.d.ts +8 -7
  22. package/dist/react/index.js +6 -6
  23. package/dist/{script-debugger-Cu_coj-h.d.ts → script-debugger-DtUGxK9i.d.ts} +1 -1
  24. package/dist/{task-agent-runner-CMq9Cir1.d.ts → task-agent-runner-DzV_OUZ7.d.ts} +1 -1
  25. package/dist/ui/billing.js +7 -7
  26. package/dist/ui/device-create.js +7 -7
  27. package/dist/ui/device-mirror.js +8 -8
  28. package/dist/ui/devices.d.ts +3 -3
  29. package/dist/ui/devices.js +11 -11
  30. package/dist/ui/editor.d.ts +1 -1
  31. package/dist/ui/editor.js +8 -8
  32. package/dist/ui/index.d.ts +12 -6
  33. package/dist/ui/index.js +118 -100
  34. package/dist/ui/inspector.js +7 -7
  35. package/dist/ui/market.js +7 -7
  36. package/dist/ui/mirror.d.ts +5 -3
  37. package/dist/ui/mirror.js +1 -1
  38. package/dist/ui/script-studio.js +7 -7
  39. package/dist/ui/scripts.js +7 -7
  40. package/dist/ui/tasks.js +11 -11
  41. package/package.json +112 -40
  42. package/styles.css +1 -1
  43. package/tailwind-preset.cjs +3 -3
  44. package/dist/device-session-W7I3WQXF.js +0 -2
@@ -1,12 +1,12 @@
1
1
  import * as react from 'react';
2
2
  import react__default from 'react';
3
- import { S as ScriptEvent, a as ScriptEngine } from '../script-debugger-Cu_coj-h.js';
3
+ import { S as ScriptEvent, a as ScriptEngine } from '../script-debugger-DtUGxK9i.js';
4
4
  import * as _uiw_react_codemirror from '@uiw/react-codemirror';
5
5
  export { ControlBar, ControlBarProps, MirrorView, MirrorViewProps } from './mirror.js';
6
- import { E as EnvOs, d as EnvRoute, e as EnvEventKind } from '../config-fsx4jlLK.js';
6
+ import { E as EnvOs, d as EnvRoute, e as EnvEventKind } from '../config-CLi5IhmO.js';
7
7
  import { N as NodeRow } from '../types-C2WXVcam.js';
8
8
  import '../coords-LPR_MPyp.js';
9
- import '../mirror-session-DM-trg1F.js';
9
+ import '../mirror-session-BP7Rd3Jk.js';
10
10
 
11
11
  interface DebugConsoleProps {
12
12
  events: ScriptEvent[];
@@ -42,7 +42,7 @@ interface ScriptPanelProps {
42
42
  * event console + rpc call panel, all driven by `useScript`. */
43
43
  declare function ScriptPanel({ deviceId, defaultEngine, defaultScript, className }: ScriptPanelProps): react__default.JSX.Element;
44
44
 
45
- /** All semantic CSS variables consumed by `aixautots/ui` components. The flat
45
+ /** All semantic CSS variables consumed by `@aixnn/aixautots/ui` components. The flat
46
46
  * `--aix-*` naming (no sub-namespace) is the intentional convention for this package. */
47
47
  declare const AIX_CSS_VARS: readonly ["--aix-bg", "--aix-fg", "--aix-muted", "--aix-accent", "--aix-danger", "--aix-border", "--aix-radius", "--aix-font", "--aix-mono", "--aix-editor-bg", "--aix-editor-fg"];
48
48
  /** A CodeMirror theme extension that draws from the `--aix-editor-*` variables
@@ -55,7 +55,7 @@ interface EnvInitDialogProps {
55
55
  /** The bound local node id to initialize. */
56
56
  nodeId: string;
57
57
  /** Host OS — selects mac-env vs win-env on the daemon. */
58
- os: EnvOs;
58
+ os: EnvOs | 'linux';
59
59
  /** win-only route; ignored for mac. Defaults to server-side 'wsl2'. */
60
60
  route?: EnvRoute;
61
61
  /** 'prompt' (default): require a click to start. 'auto': start on open. */
@@ -71,6 +71,8 @@ interface EnvInitDialogProps {
71
71
  * instead of a plain retry. The daemon can't self-elevate/reboot, so the
72
72
  * desktop wires this to Tauri commands. */
73
73
  onInstallWsl?: () => void | Promise<void>;
74
+ /** Host preparation, awaited before every setup attempt (including Retry). */
75
+ beforeSetup?: (nodeId: string) => Promise<void>;
74
76
  title?: string;
75
77
  }
76
78
  /** Self-driving env-base initialization dialog. Requires an `<AixProvider>`
@@ -90,13 +92,17 @@ interface VmItem {
90
92
  * rows expose an "初始化" action; `needs-image` rows expose "下载镜像". */
91
93
  declare function vmPlan(node: NodeRow): VmItem[];
92
94
  interface NodeCapabilityPanelProps {
95
+ /** Start and connect the local host before initialization or image download. */
96
+ beforeSetup?: (nodeId: string) => Promise<void>;
93
97
  node: NodeRow;
94
98
  /** Tauri host? enables the WSL2 elevated-install resolver in the dialog. */
95
99
  isTauri?: boolean;
100
+ /** Known local host OS, only when node.id matches the host process. */
101
+ localEnvOs?: EnvOs | null;
96
102
  /** Host-side WSL2 install resolver (Windows desktop). */
97
103
  onInstallWsl?: () => void | Promise<void>;
98
104
  }
99
105
  /** 「虚拟机与设备能力」面板:四平台能力行 + 初始化/下载镜像 + 流式进度。 */
100
- declare function NodeCapabilityPanel({ node, isTauri, onInstallWsl }: NodeCapabilityPanelProps): react.JSX.Element;
106
+ declare function NodeCapabilityPanel({ node: reportedNode, isTauri, onInstallWsl, localEnvOs, beforeSetup }: NodeCapabilityPanelProps): react.JSX.Element;
101
107
 
102
108
  export { AIX_CSS_VARS, DebugConsole, type DebugConsoleProps, EnvInitDialog, type EnvInitDialogProps, NodeCapabilityPanel, type NodeCapabilityPanelProps, ScriptEditor, type ScriptEditorProps, ScriptPanel, type ScriptPanelProps, aixCodeMirrorTheme, vmPlan };
package/dist/ui/index.js CHANGED
@@ -1,10 +1,10 @@
1
- export { ControlBar, MirrorView } from '../chunk-CVV7FOMQ.js';
1
+ export { ControlBar, MirrorView } from '../chunk-E7WMHM63.js';
2
2
  import { Button, Input } from '../chunk-EVHTAXQG.js';
3
- import { useScript, useEnvRun, useClient } from '../chunk-UINEPEIE.js';
4
- import '../chunk-OXIM6EYO.js';
5
- import { envBlocker, summarizeEnv } from '../chunk-TATL3HTE.js';
3
+ import { useScript, useEnvRun, useClient } from '../chunk-A5VNENHD.js';
4
+ import '../chunk-JTFZSFFA.js';
5
+ import { summarizeEnv, envBlocker, detectEnvOs } from '../chunk-B2BOVLI6.js';
6
6
  import '../chunk-NWFYTFMI.js';
7
- import React4, { useState, useId, useRef, useEffect, useMemo } from 'react';
7
+ import React4, { useState, useId, useRef, useMemo, useEffect } from 'react';
8
8
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
9
9
  import CodeMirror, { EditorView } from '@uiw/react-codemirror';
10
10
  import { javascript } from '@codemirror/lang-javascript';
@@ -239,21 +239,45 @@ var btn3 = (primary) => ({
239
239
  });
240
240
  function EnvInitDialog(props) {
241
241
  const { open, onClose, nodeId, os, route, mode = "prompt", seedEvents, onReady, onInstallWsl, title } = props;
242
- const { events, finished, done, error, setup } = useEnvRun();
242
+ const { reqId, events, finished: streamFinished, error, setup } = useEnvRun(props.beforeSetup);
243
+ const confirmation = useEnvRun();
244
+ const confirmationStarted = useRef(false);
245
+ const [minimized, setMinimized] = useState(false);
243
246
  const [started, setStarted] = useState(false);
244
247
  const [showLogs, setShowLogs] = useState(false);
245
248
  const [installing, setInstalling] = useState(false);
246
249
  const [wslFailed, setWslFailed] = useState(false);
247
250
  const readyFired = useRef(false);
248
251
  const wslTried = useRef(false);
252
+ const summary = useMemo(
253
+ () => summarizeEnv(started ? events : seedEvents ?? []),
254
+ [started, events, seedEvents]
255
+ );
256
+ const checked = summarizeEnv(confirmation.events);
257
+ const confirmed = confirmationStarted.current && confirmation.finished ? checked.ready ? confirmation.finished : { ...confirmation.finished, ok: false, error: confirmation.finished.error ?? "\u73AF\u5883\u68C0\u67E5\u672A\u901A\u8FC7\uFF0C\u8BF7\u91CD\u8BD5\u521D\u59CB\u5316\u3002" } : null;
258
+ const finished = streamFinished ?? (started ? summary.finished : null) ?? confirmed;
259
+ const done = !!finished;
260
+ useEffect(() => {
261
+ if (!open || !started || finished || confirmationStarted.current) return;
262
+ const verified = summary.steps.some((s) => s.id === "verify" && ["ok", "done", "skipped", "present"].includes(s.state));
263
+ if (!verified) return;
264
+ const timer = setTimeout(() => {
265
+ confirmationStarted.current = true;
266
+ void confirmation.status(nodeId, { os }).catch(() => {
267
+ });
268
+ }, 1500);
269
+ return () => clearTimeout(timer);
270
+ }, [open, started, finished, summary.steps, confirmation.status, nodeId, os]);
249
271
  useEffect(() => {
250
272
  if (open) {
273
+ setMinimized(false);
251
274
  setStarted(false);
252
275
  setShowLogs(false);
253
276
  setInstalling(false);
254
277
  setWslFailed(false);
255
278
  readyFired.current = false;
256
279
  wslTried.current = false;
280
+ confirmationStarted.current = false;
257
281
  }
258
282
  }, [open, nodeId]);
259
283
  const wslBlocked = done && envBlocker(finished) === "wsl-missing" && !!onInstallWsl;
@@ -275,32 +299,74 @@ function EnvInitDialog(props) {
275
299
  }
276
300
  }, [wslBlocked, installing, wslFailed, installWsl]);
277
301
  const begin = React4.useCallback(() => {
302
+ confirmation.close();
303
+ confirmationStarted.current = false;
278
304
  setStarted(true);
279
305
  void setup(nodeId, { os, route }).catch(() => {
280
306
  });
281
- }, [setup, nodeId, os, route]);
307
+ }, [setup, nodeId, os, route, confirmation.close]);
282
308
  useEffect(() => {
283
309
  if (open && mode === "auto" && !started) begin();
284
310
  }, [open, mode, started, begin]);
285
311
  useEffect(() => {
286
- if (done && finished?.ok && !readyFired.current) {
312
+ if (open && started && done && finished?.ok && !readyFired.current) {
287
313
  readyFired.current = true;
288
314
  onReady?.();
289
315
  }
290
- }, [done, finished, onReady]);
291
- const summary = useMemo(
292
- () => summarizeEnv(started ? events : seedEvents ?? []),
293
- [started, events, seedEvents]
294
- );
316
+ }, [open, started, done, finished, onReady]);
295
317
  if (!open) return null;
296
318
  const pct = summary.steps.length ? Math.round(summary.steps.reduce((a, s) => a + (s.state === "ok" || s.state === "done" || s.state === "skipped" || s.state === "present" ? 100 : s.pct), 0) / summary.steps.length) : 0;
297
- const failed = done && finished && !finished.ok;
319
+ const failed = !!error || confirmationStarted.current && !!confirmation.error || done && !!finished && !finished.ok;
298
320
  const success = done && finished?.ok;
321
+ if (minimized) return /* @__PURE__ */ jsxs("div", { role: "status", style: {
322
+ position: "fixed",
323
+ bottom: 16,
324
+ left: 16,
325
+ right: 16,
326
+ zIndex: 1e3,
327
+ background: "var(--aix-bg, #14161a)",
328
+ color: "var(--aix-fg, #e6e6e6)",
329
+ border: "1px solid var(--aix-border, #2a2e35)",
330
+ borderRadius: 10,
331
+ padding: "12px 16px",
332
+ boxShadow: "0 4px 20px rgba(0,0,0,.2)",
333
+ display: "flex",
334
+ alignItems: "center",
335
+ gap: 16
336
+ }, children: [
337
+ /* @__PURE__ */ jsxs("div", { style: { flex: 1, minWidth: 0 }, children: [
338
+ /* @__PURE__ */ jsxs("div", { style: { fontSize: 13, marginBottom: 6 }, children: [
339
+ title ?? "Android \u73AF\u5883\u521D\u59CB\u5316",
340
+ " \xB7 ",
341
+ success ? "\u5DF2\u5B8C\u6210" : failed ? "\u521D\u59CB\u5316\u5931\u8D25" : !reqId ? "\u6B63\u5728\u8FDE\u63A5\u8282\u70B9\u2026" : "\u6B63\u5728\u521D\u59CB\u5316\u2026",
342
+ " ",
343
+ pct,
344
+ "%"
345
+ ] }),
346
+ /* @__PURE__ */ jsx(
347
+ "div",
348
+ {
349
+ role: "progressbar",
350
+ "aria-valuemin": 0,
351
+ "aria-valuemax": 100,
352
+ "aria-valuenow": pct,
353
+ "aria-label": "\u521D\u59CB\u5316\u8FDB\u5EA6",
354
+ style: { height: 5, background: "var(--aix-border, #2a2e35)", borderRadius: 999, overflow: "hidden" },
355
+ children: /* @__PURE__ */ jsx("div", { style: { width: `${pct}%`, height: "100%", background: failed ? "var(--aix-danger, #e5484d)" : "var(--aix-accent, #2d6cdf)" } })
356
+ }
357
+ )
358
+ ] }),
359
+ /* @__PURE__ */ jsx("button", { style: btn3(), onClick: () => setMinimized(false), children: "\u5C55\u5F00" }),
360
+ (success || failed) && /* @__PURE__ */ jsx("button", { style: btn3(), onClick: onClose, children: "\u5173\u95ED" })
361
+ ] });
299
362
  return /* @__PURE__ */ jsx("div", { style: overlay, role: "dialog", "aria-modal": "true", onClick: (e) => {
300
363
  if (e.target === e.currentTarget && !started) onClose();
301
364
  }, children: /* @__PURE__ */ jsxs("div", { style: card, children: [
302
- /* @__PURE__ */ jsx("div", { style: { fontSize: 16, fontWeight: 600, marginBottom: 4 }, children: title ?? (os === "win" ? "Set up the Android host base (WSL2)" : "Set up the Android host base") }),
303
- /* @__PURE__ */ jsx("div", { style: { color: "var(--aix-muted, #8a8a8a)", fontSize: 13, marginBottom: 16 }, children: success ? "Done \u2014 this machine can now run cloud phones." : wslBlocked && wslFailed ? "\u81EA\u52A8\u5B89\u88C5 WSL \u8FD0\u884C\u65F6\u5931\u8D25\uFF08\u53EF\u80FD\u5185\u7F51\u65E0\u6CD5\u4E0B\u8F7D\uFF09\u3002\u8BF7\u6309\u4E0B\u65B9\u6B65\u9AA4\u624B\u52A8\u4E0B\u8F7D\u5B89\u88C5\u540E\u91CD\u8BD5\u3002" : wslBlocked ? '\u9700\u8981\u5148\u5B89\u88C5 WSL \u8FD0\u884C\u65F6\uFF1A\u6B63\u5728\u81EA\u52A8\u4E0B\u8F7D\u5E76\u5B89\u88C5\uFF08\u9700\u5728 UAC \u5F39\u7A97\u70B9"\u662F"\uFF0C\u7EA6 250MB\uFF09\uFF0C\u5B8C\u6210\u540E\u4F1A\u81EA\u52A8\u91CD\u542F\u5E76\u7EE7\u7EED\u3002' : failed ? "Setup failed. Review the steps below and retry." : started ? "Installing the redroid base. This downloads ~1\u20132 GB and may take several minutes." : "This machine needs a one-time base (kernel + container runtime + image) to host cloud phones." }),
365
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", justifyContent: "space-between", gap: 16, alignItems: "center", marginBottom: 8 }, children: [
366
+ /* @__PURE__ */ jsx("span", { style: { fontSize: 16, fontWeight: 600 }, children: title ?? "\u521D\u59CB\u5316 Android \u73AF\u5883\u5E95\u5EA7" }),
367
+ /* @__PURE__ */ jsx("button", { style: btn3(), onClick: () => setMinimized(true), children: "\u6700\u5C0F\u5316" })
368
+ ] }),
369
+ /* @__PURE__ */ jsx("div", { style: { color: "var(--aix-muted, #8a8a8a)", fontSize: 13, marginBottom: 16 }, children: success ? "\u521D\u59CB\u5316\u6210\u529F\uFF0C\u73AF\u5883\u548C\u955C\u50CF\u5DF2\u5C31\u7EEA\uFF0C\u53EF\u4EE5\u4F7F\u7528\u4E91\u624B\u673A\u3002" : wslBlocked && wslFailed ? "\u81EA\u52A8\u5B89\u88C5 WSL \u8FD0\u884C\u65F6\u5931\u8D25\uFF08\u53EF\u80FD\u5185\u7F51\u65E0\u6CD5\u4E0B\u8F7D\uFF09\u3002\u8BF7\u6309\u4E0B\u65B9\u6B65\u9AA4\u624B\u52A8\u4E0B\u8F7D\u5B89\u88C5\u540E\u91CD\u8BD5\u3002" : wslBlocked ? '\u9700\u8981\u5148\u5B89\u88C5 WSL \u8FD0\u884C\u65F6\uFF1A\u6B63\u5728\u81EA\u52A8\u4E0B\u8F7D\u5E76\u5B89\u88C5\uFF08\u9700\u5728 UAC \u5F39\u7A97\u70B9"\u662F"\uFF0C\u7EA6 250MB\uFF09\uFF0C\u5B8C\u6210\u540E\u4F1A\u81EA\u52A8\u91CD\u542F\u5E76\u7EE7\u7EED\u3002' : failed ? "Setup failed. Review the steps below and retry." : started && !reqId ? "\u6B63\u5728\u542F\u52A8\u5E76\u8FDE\u63A5\u8282\u70B9\uFF0C\u9996\u6B21\u542F\u52A8\u4F1A\u81EA\u52A8\u68C0\u67E5\u3001\u4E0B\u8F7D\u6240\u9700\u7EC4\u4EF6\uFF0C\u53EF\u80FD\u9700\u8981\u51E0\u5206\u949F\u3002\u8FDE\u63A5\u6210\u529F\u540E\u81EA\u52A8\u5F00\u59CB\u521D\u59CB\u5316\u3002" : started ? "Installing the redroid base. This downloads ~1\u20132 GB and may take several minutes." : "This machine needs a one-time base (kernel + container runtime + image) to host cloud phones." }),
304
370
  (started || summary.steps.length > 0) && /* @__PURE__ */ jsxs(Fragment, { children: [
305
371
  /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 10, marginBottom: 14 }, children: [
306
372
  /* @__PURE__ */ jsx("div", { style: { flex: 1, height: 6, background: "var(--aix-border, #2a2e35)", borderRadius: 999, overflow: "hidden" }, children: /* @__PURE__ */ jsx("div", { style: { width: `${pct}%`, height: "100%", background: failed ? "var(--aix-danger, #e5484d)" : "var(--aix-accent, #2d6cdf)", transition: "width .3s" } }) }),
@@ -309,6 +375,7 @@ function EnvInitDialog(props) {
309
375
  "%"
310
376
  ] })
311
377
  ] }),
378
+ started && events.length === 0 && !failed && /* @__PURE__ */ jsx("div", { role: "status", style: { color: "var(--aix-muted, #8a8a8a)", fontSize: 13, marginBottom: 12 }, children: "\u6B63\u5728\u8FDE\u63A5\u8282\u70B9\u5E76\u7B49\u5F85\u521D\u59CB\u5316\u6B65\u9AA4\u2026" }),
312
379
  /* @__PURE__ */ jsx("ul", { style: { listStyle: "none", margin: 0, padding: 0, display: "grid", gap: 8 }, children: summary.steps.map((s) => /* @__PURE__ */ jsxs("li", { style: { display: "flex", alignItems: "baseline", gap: 10, fontSize: 13 }, children: [
313
380
  /* @__PURE__ */ jsx("span", { style: { color: stateColor(s.state), width: 16, textAlign: "center" }, children: STATE_ICON[s.state] ?? "\xB7" }),
314
381
  /* @__PURE__ */ jsxs("span", { style: { flex: 1 }, children: [
@@ -331,6 +398,11 @@ function EnvInitDialog(props) {
331
398
  finished.hint
332
399
  ] }) : null
333
400
  ] }),
401
+ confirmationStarted.current && confirmation.error && !finished && /* @__PURE__ */ jsxs("div", { role: "alert", style: { marginTop: 12, color: "var(--aix-danger, #e5484d)" }, children: [
402
+ "\u65E0\u6CD5\u786E\u8BA4\u521D\u59CB\u5316\u7ED3\u679C\uFF1A",
403
+ confirmation.error.message,
404
+ "\u3002\u8BF7\u91CD\u65B0\u68C0\u67E5\u8282\u70B9\u72B6\u6001\u3002"
405
+ ] }),
334
406
  error && !finished && /* @__PURE__ */ jsxs("div", { style: { marginTop: 12, color: "var(--aix-danger, #e5484d)", fontSize: 13 }, children: [
335
407
  "Could not start setup: ",
336
408
  error.message
@@ -369,7 +441,7 @@ function EnvInitDialog(props) {
369
441
  ] }),
370
442
  showLogs && /* @__PURE__ */ jsx("pre", { style: { marginTop: 6, maxHeight: 160, overflow: "auto", background: "var(--aix-editor-bg, #0e0f12)", color: "var(--aix-editor-fg, #cfcfcf)", padding: 10, borderRadius: 8, fontSize: 12, fontFamily: "var(--aix-mono, ui-monospace, Menlo, monospace)" }, children: summary.logs.slice(-200).join("\n") })
371
443
  ] }),
372
- /* @__PURE__ */ jsx("div", { style: { display: "flex", justifyContent: "flex-end", gap: 10, marginTop: 18 }, children: success ? /* @__PURE__ */ jsx("button", { style: btn3(true), onClick: onClose, children: "Done" }) : wslBlocked && wslFailed ? /* @__PURE__ */ jsxs(Fragment, { children: [
444
+ /* @__PURE__ */ jsx("div", { style: { display: "flex", justifyContent: "flex-end", gap: 10, marginTop: 18 }, children: success ? /* @__PURE__ */ jsx("button", { style: btn3(true), onClick: onClose, children: "\u5B8C\u6210" }) : wslBlocked && wslFailed ? /* @__PURE__ */ jsxs(Fragment, { children: [
373
445
  /* @__PURE__ */ jsx("button", { style: btn3(), onClick: onClose, children: "\u5173\u95ED" }),
374
446
  /* @__PURE__ */ jsx("button", { style: btn3(true), onClick: begin, children: "\u91CD\u8BD5\uFF08\u5DF2\u624B\u52A8\u88C5\u597D\uFF09" })
375
447
  ] }) : wslBlocked ? /* @__PURE__ */ jsx("button", { style: btn3(), disabled: true, onClick: () => {
@@ -398,6 +470,19 @@ function envOsOf(node) {
398
470
  const os = str(sys(node, "os"));
399
471
  return os === "macos" ? "mac" : os === "windows" ? "win" : null;
400
472
  }
473
+ function withLocalEnvOs(node, os) {
474
+ if (!node.is_owner || !os || envOsOf(node) || sys(node, "os")) return node;
475
+ return {
476
+ ...node,
477
+ reported_caps: {
478
+ ...node.reported_caps,
479
+ system: {
480
+ ...node.reported_caps?.system,
481
+ os: os === "win" ? "windows" : "macos"
482
+ }
483
+ }
484
+ };
485
+ }
401
486
  function vmPlan(node) {
402
487
  const eff = node.effective_caps;
403
488
  const os = str(sys(node, "os"));
@@ -455,57 +540,6 @@ function vmPlan(node) {
455
540
  );
456
541
  return out;
457
542
  }
458
- function ImagePullProgress({
459
- events,
460
- done,
461
- finished,
462
- error,
463
- onClose
464
- }) {
465
- const failed = !!error || done && finished !== null && !finished.ok;
466
- const stepsMeta = [];
467
- const stepState = /* @__PURE__ */ new Map();
468
- const logs = [];
469
- for (const e of events) {
470
- if (e.kind === "started") stepsMeta.push(...e.steps);
471
- if (e.kind === "step") stepState.set(e.id, { state: e.state, pct: e.pct, detail: e.detail });
472
- if (e.kind === "log") logs.push(e.line);
473
- }
474
- const recentLogs = logs.slice(-6);
475
- const activeStep = stepsMeta.find((s) => stepState.get(s.id)?.state === "running");
476
- return /* @__PURE__ */ jsxs("div", { className: "rounded border border-border bg-card/60 p-3 text-[11px] space-y-2", children: [
477
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
478
- /* @__PURE__ */ jsx("span", { className: "font-medium text-xs text-foreground", children: done ? failed ? "\u4E0B\u8F7D\u5931\u8D25" : "\u4E0B\u8F7D\u5B8C\u6210" : activeStep ? `\u6B63\u5728\u6267\u884C\uFF1A${activeStep.label}` : "\u6B63\u5728\u8FDE\u63A5\u8282\u70B9\u2026" }),
479
- done && /* @__PURE__ */ jsx("button", { onClick: onClose, className: "text-muted-foreground hover:text-foreground text-[11px] ml-2", children: "\u5173\u95ED" })
480
- ] }),
481
- stepsMeta.length > 0 && /* @__PURE__ */ jsx("div", { className: "space-y-1", children: stepsMeta.map((s) => {
482
- const st = stepState.get(s.id);
483
- const dotClass = st?.state === "ok" ? "bg-success" : st?.state === "running" ? "bg-warning animate-pulse" : st?.state === "failed" ? "bg-destructive" : "bg-muted-foreground/30";
484
- return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
485
- /* @__PURE__ */ jsx("span", { className: `h-1.5 w-1.5 shrink-0 rounded-full ${dotClass}` }),
486
- /* @__PURE__ */ jsx("span", { className: "flex-1 text-muted-foreground", children: s.label }),
487
- st?.state === "running" && st.pct > 0 && /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground whitespace-nowrap", children: [
488
- st.pct,
489
- "%",
490
- st.detail ? ` \xB7 ${st.detail}` : ""
491
- ] }),
492
- st?.detail && st.state !== "running" && /* @__PURE__ */ jsx("span", { className: "text-muted-foreground truncate max-w-[180px]", children: st.detail })
493
- ] }, s.id);
494
- }) }),
495
- activeStep && (() => {
496
- const pct = stepState.get(activeStep.id)?.pct ?? 0;
497
- return pct > 0 ? /* @__PURE__ */ jsx("div", { className: "h-1 w-full rounded-full bg-muted overflow-hidden", children: /* @__PURE__ */ jsx(
498
- "div",
499
- {
500
- className: "h-full bg-primary rounded-full transition-all duration-300",
501
- style: { width: `${pct}%` }
502
- }
503
- ) }) : null;
504
- })(),
505
- recentLogs.length > 0 && /* @__PURE__ */ jsx("pre", { className: "text-[10px] font-mono text-muted-foreground bg-muted/20 rounded p-2 max-h-24 overflow-y-auto leading-relaxed whitespace-pre-wrap break-all", children: recentLogs.join("\n") }),
506
- done && failed && /* @__PURE__ */ jsx("p", { className: "text-destructive", children: error?.message ?? finished?.error ?? "\u955C\u50CF\u62C9\u53D6\u5931\u8D25\uFF0C\u8BF7\u67E5\u770B\u6B65\u9AA4\u8BE6\u60C5\u540E\u91CD\u8BD5" })
507
- ] });
508
- }
509
543
  function VmCapRow({
510
544
  node,
511
545
  vm,
@@ -582,21 +616,12 @@ function AndroidImageRows({ images, installed }) {
582
616
  ] }, img.id);
583
617
  }) });
584
618
  }
585
- function NodeCapabilityPanel({ node, isTauri, onInstallWsl }) {
619
+ function NodeCapabilityPanel({ node: reportedNode, isTauri, onInstallWsl, localEnvOs, beforeSetup }) {
586
620
  const client = useClient();
621
+ const localOs = localEnvOs ?? (client.localNode?.nodeId === reportedNode.id ? client.localNode.envOs ?? detectEnvOs() : null);
622
+ const node = withLocalEnvOs(reportedNode, localOs);
587
623
  const [init, setInit] = useState(null);
588
- const initOs = envOsOf(node);
589
- const envRun = useEnvRun();
590
- const imagePulling = envRun.reqId !== null && !envRun.done;
591
- const showImagePanel = envRun.reqId !== null;
592
- const handleDownload = async () => {
593
- const setupOs = sys(node, "os") === "linux" ? "linux" : initOs;
594
- if (!setupOs || imagePulling) return;
595
- try {
596
- await envRun.setup(node.id, { os: setupOs });
597
- } catch {
598
- }
599
- };
624
+ const initOs = sys(node, "os") === "linux" ? "linux" : envOsOf(node);
600
625
  const [androidImages, setAndroidImages] = useState([]);
601
626
  useEffect(() => {
602
627
  let cancelled = false;
@@ -609,37 +634,30 @@ function NodeCapabilityPanel({ node, isTauri, onInstallWsl }) {
609
634
  };
610
635
  }, [client]);
611
636
  const installed = installedTags(node);
637
+ const usbDiagnostic = node.reported_caps?.ios_usb_diagnostic;
612
638
  return /* @__PURE__ */ jsxs("section", { children: [
613
639
  /* @__PURE__ */ jsx("h3", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2", children: "\u865A\u62DF\u673A\u4E0E\u8BBE\u5907\u80FD\u529B" }),
640
+ usbDiagnostic && typeof usbDiagnostic.message === "string" && /* @__PURE__ */ jsxs("div", { role: "alert", className: "mb-3 rounded border border-destructive/50 p-3 text-sm", children: [
641
+ /* @__PURE__ */ jsx("p", { children: usbDiagnostic.message }),
642
+ Array.isArray(usbDiagnostic.instance_ids) && usbDiagnostic.instance_ids.filter((id) => typeof id === "string").map((id) => /* @__PURE__ */ jsx("p", { className: "mt-2 break-all font-mono text-xs", children: id }, id)),
643
+ typeof usbDiagnostic.hint === "string" && /* @__PURE__ */ jsx("p", { className: "mt-2 whitespace-pre-wrap", children: usbDiagnostic.hint })
644
+ ] }),
614
645
  !node.reported_caps ? /* @__PURE__ */ jsx("p", { className: "text-[11px] text-muted-foreground", children: "\u80FD\u529B\u672A\u77E5\uFF1A\u8282\u70B9\u5C1A\u672A\u8FDE\u63A5\u6216\u4E3A\u65E7\u7248\u672C\uFF08\u9700\u5347\u7EA7\u4EE5\u4E0A\u62A5\u80FD\u529B\uFF09\u3002" }) : /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
646
+ !reportedNode.reported_caps && /* @__PURE__ */ jsx("p", { className: "text-[11px] text-muted-foreground", children: "\u5DF2\u8BC6\u522B\u672C\u673A\u7CFB\u7EDF\uFF0C\u53EF\u521D\u59CB\u5316\u73AF\u5883\uFF1B\u8282\u70B9\u80FD\u529B\u5C1A\u672A\u4E0A\u62A5\uFF0C\u8BF7\u786E\u4FDD\u8282\u70B9\u5DF2\u8FDE\u63A5\u8BBE\u5907\u7F51\u5173\u3002" }),
615
647
  vmPlan(node).map((vm) => /* @__PURE__ */ jsxs("div", { children: [
616
648
  /* @__PURE__ */ jsx(
617
649
  VmCapRow,
618
650
  {
619
651
  node,
620
652
  vm,
621
- onInit: () => {
622
- if (sys(node, "os") === "linux") void handleDownload();
623
- else setInit(vm);
624
- },
625
- onDownload: handleDownload,
626
- downloading: imagePulling
653
+ onInit: () => setInit(vm),
654
+ onDownload: () => setInit(vm)
627
655
  }
628
656
  ),
629
657
  vm.key === "android" && vm.state !== "unavailable" && androidImages.length > 0 && /* @__PURE__ */ jsx(AndroidImageRows, { images: androidImages, installed })
630
- ] }, vm.key)),
631
- showImagePanel && /* @__PURE__ */ jsx(
632
- ImagePullProgress,
633
- {
634
- events: envRun.events,
635
- done: envRun.done,
636
- finished: envRun.finished,
637
- error: envRun.error,
638
- onClose: () => envRun.close()
639
- }
640
- )
658
+ ] }, vm.key))
641
659
  ] }),
642
- node.is_owner && /* @__PURE__ */ jsx(DataRootConfig, { node }),
660
+ node.is_owner && (supportsRuntimeDataRoot(node) || sys(node, "os") === "linux") && /* @__PURE__ */ jsx(DataRootConfig, { node }),
643
661
  init && initOs && /* @__PURE__ */ jsx(
644
662
  EnvInitDialog,
645
663
  {
@@ -647,6 +665,7 @@ function NodeCapabilityPanel({ node, isTauri, onInstallWsl }) {
647
665
  nodeId: node.id,
648
666
  os: initOs,
649
667
  mode: "prompt",
668
+ beforeSetup,
650
669
  title: `\u521D\u59CB\u5316 ${init.label} \u73AF\u5883\u5E95\u5EA7`,
651
670
  onInstallWsl: isTauri ? onInstallWsl : void 0,
652
671
  onClose: () => setInit(null),
@@ -655,7 +674,6 @@ function NodeCapabilityPanel({ node, isTauri, onInstallWsl }) {
655
674
  await client.nodes.restart(node.id);
656
675
  } catch {
657
676
  }
658
- setInit(null);
659
677
  }
660
678
  }
661
679
  )
@@ -1,11 +1,11 @@
1
- import { useAixT } from '../chunk-64Q7BBIQ.js';
1
+ import { useAixT } from '../chunk-T3QVYTOT.js';
2
2
  import { Select, Button, cn, Input, Dialog } from '../chunk-EVHTAXQG.js';
3
- import { useInspectorView, useDevicesView, useLocators } from '../chunk-O34SNDQB.js';
4
- import '../chunk-V4MXFPDX.js';
5
- import '../chunk-IJVNII5N.js';
6
- import { useClient } from '../chunk-UINEPEIE.js';
7
- import '../chunk-OXIM6EYO.js';
8
- import '../chunk-TATL3HTE.js';
3
+ import { useInspectorView, useDevicesView, useLocators } from '../chunk-Q63FQ7B5.js';
4
+ import '../chunk-BUW45GM2.js';
5
+ import '../chunk-LAZ3RQ7X.js';
6
+ import { useClient } from '../chunk-A5VNENHD.js';
7
+ import '../chunk-JTFZSFFA.js';
8
+ import '../chunk-B2BOVLI6.js';
9
9
  import '../chunk-NWFYTFMI.js';
10
10
  import { useState, useMemo, useEffect, useCallback, useRef } from 'react';
11
11
  import { Upload, RefreshCw, ChevronsUp, ChevronsDown, MousePointer2, Circle, Square, Search, Laptop, Smartphone, Check, Copy, Crosshair, TimerReset, Eraser, ImageDown, Keyboard, Save, Trash2, X, ChevronDown, ChevronRight, ArrowLeft, Home, SquareStack, CornerDownLeft, Delete } from 'lucide-react';
package/dist/ui/market.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import { useAixNav } from '../chunk-5BMFMDQR.js';
2
- import { useAixT } from '../chunk-64Q7BBIQ.js';
3
- import { useScripts } from '../chunk-O34SNDQB.js';
4
- import '../chunk-V4MXFPDX.js';
5
- import '../chunk-IJVNII5N.js';
6
- import '../chunk-UINEPEIE.js';
7
- import '../chunk-OXIM6EYO.js';
8
- import '../chunk-TATL3HTE.js';
2
+ import { useAixT } from '../chunk-T3QVYTOT.js';
3
+ import { useScripts } from '../chunk-Q63FQ7B5.js';
4
+ import '../chunk-BUW45GM2.js';
5
+ import '../chunk-LAZ3RQ7X.js';
6
+ import '../chunk-A5VNENHD.js';
7
+ import '../chunk-JTFZSFFA.js';
8
+ import '../chunk-B2BOVLI6.js';
9
9
  import '../chunk-NWFYTFMI.js';
10
10
  import { Pencil, Store } from 'lucide-react';
11
11
  import { jsx, jsxs } from 'react/jsx-runtime';
@@ -1,7 +1,7 @@
1
1
  import react__default from 'react';
2
2
  import { D as DeviceSize } from '../coords-LPR_MPyp.js';
3
- import { C as ControlMessage } from '../mirror-session-DM-trg1F.js';
4
- import '../config-fsx4jlLK.js';
3
+ import { C as ControlMessage } from '../mirror-session-BP7Rd3Jk.js';
4
+ import '../config-CLi5IhmO.js';
5
5
  import '../types-C2WXVcam.js';
6
6
 
7
7
  interface MirrorViewProps {
@@ -25,6 +25,8 @@ interface MirrorViewProps {
25
25
  * without a continuous-injection backend, e.g. iOS). Android mirror turns
26
26
  * this on so drags/scrolls follow the actual pointer path. */
27
27
  continuousTouch?: boolean;
28
+ /** Local playback gain, 0 (muted) to 1. */
29
+ volume?: number;
28
30
  className?: string;
29
31
  }
30
32
  /** Live device video that turns mouse + keyboard into `ControlMessage`s.
@@ -34,7 +36,7 @@ interface MirrorViewProps {
34
36
  * - `continuousTouch`: pointerdown/move/up stream `touch_down`/`touch_move`/
35
37
  * `touch_up` in real time, so drags follow the actual pointer path.
36
38
  * keydown becomes a `key` (special keys) or `text` (printable) message. */
37
- declare function MirrorView({ stream, deviceSize, onInput, keyboard, autoFocus, onFirstFrame, onResize, continuousTouch, className, }: MirrorViewProps): react__default.JSX.Element;
39
+ declare function MirrorView({ stream, deviceSize, onInput, keyboard, autoFocus, onFirstFrame, onResize, continuousTouch, volume, className, }: MirrorViewProps): react__default.JSX.Element;
38
40
 
39
41
  interface ControlBarProps {
40
42
  /** Picks the nav-key icon set; Android additionally gets a Menu (recents)
package/dist/ui/mirror.js CHANGED
@@ -1,3 +1,3 @@
1
1
  import '../chunk-OEZFYKL6.js';
2
- export { ControlBar, MirrorView } from '../chunk-CVV7FOMQ.js';
2
+ export { ControlBar, MirrorView } from '../chunk-E7WMHM63.js';
3
3
  import '../chunk-NWFYTFMI.js';
@@ -1,10 +1,10 @@
1
- export { CodeEditor, DeviceSelect, RunPanel, ScriptParamEditor, ScriptStudio, TimelineStep } from '../chunk-XNKC6HU3.js';
1
+ export { CodeEditor, DeviceSelect, RunPanel, ScriptParamEditor, ScriptStudio, TimelineStep } from '../chunk-6S3XLY5O.js';
2
2
  export { LogConsole } from '../chunk-FW23FLAF.js';
3
3
  import '../chunk-EVHTAXQG.js';
4
- import '../chunk-O34SNDQB.js';
5
- import '../chunk-V4MXFPDX.js';
6
- import '../chunk-IJVNII5N.js';
7
- import '../chunk-UINEPEIE.js';
8
- import '../chunk-OXIM6EYO.js';
9
- import '../chunk-TATL3HTE.js';
4
+ import '../chunk-Q63FQ7B5.js';
5
+ import '../chunk-BUW45GM2.js';
6
+ import '../chunk-LAZ3RQ7X.js';
7
+ import '../chunk-A5VNENHD.js';
8
+ import '../chunk-JTFZSFFA.js';
9
+ import '../chunk-B2BOVLI6.js';
10
10
  import '../chunk-NWFYTFMI.js';
@@ -1,12 +1,12 @@
1
1
  import { useAixNav } from '../chunk-5BMFMDQR.js';
2
- import { useAixT } from '../chunk-64Q7BBIQ.js';
2
+ import { useAixT } from '../chunk-T3QVYTOT.js';
3
3
  import { cn, Badge, Button, Input } from '../chunk-EVHTAXQG.js';
4
- import { useScripts } from '../chunk-O34SNDQB.js';
5
- import '../chunk-V4MXFPDX.js';
6
- import '../chunk-IJVNII5N.js';
7
- import '../chunk-UINEPEIE.js';
8
- import '../chunk-OXIM6EYO.js';
9
- import '../chunk-TATL3HTE.js';
4
+ import { useScripts } from '../chunk-Q63FQ7B5.js';
5
+ import '../chunk-BUW45GM2.js';
6
+ import '../chunk-LAZ3RQ7X.js';
7
+ import '../chunk-A5VNENHD.js';
8
+ import '../chunk-JTFZSFFA.js';
9
+ import '../chunk-B2BOVLI6.js';
10
10
  import '../chunk-NWFYTFMI.js';
11
11
  import { useState, useMemo } from 'react';
12
12
  import { AppWindow, Monitor, Smartphone, FileText, Play, Copy, Trash2, PlusCircle, LayoutGrid, Plus, Search } from 'lucide-react';
package/dist/ui/tasks.js CHANGED
@@ -1,17 +1,17 @@
1
- import { SharedParamsForm, resolveSharedRow } from '../chunk-YOT7HZBU.js';
2
- import { useAixT } from '../chunk-64Q7BBIQ.js';
1
+ import { SharedParamsForm, resolveSharedRow } from '../chunk-VKPKHUHU.js';
2
+ import { useAixT } from '../chunk-T3QVYTOT.js';
3
3
  import '../chunk-FW23FLAF.js';
4
- import '../chunk-SVK2AY3J.js';
4
+ import '../chunk-M7CKUC4U.js';
5
5
  import '../chunk-OEZFYKL6.js';
6
- import '../chunk-CVV7FOMQ.js';
7
- import '../chunk-BSHHYM72.js';
6
+ import '../chunk-E7WMHM63.js';
7
+ import '../chunk-P2Y655SL.js';
8
8
  import { Button, cn, Select, Input, Badge } from '../chunk-EVHTAXQG.js';
9
- import { useDevicesView, useAutomationQueue, useApiTokens } from '../chunk-O34SNDQB.js';
10
- import { targetParam, variablesToSchema, schemaDefaults } from '../chunk-V4MXFPDX.js';
11
- import '../chunk-IJVNII5N.js';
12
- import { useClient, useAixConfig } from '../chunk-UINEPEIE.js';
13
- import '../chunk-OXIM6EYO.js';
14
- import '../chunk-TATL3HTE.js';
9
+ import { useDevicesView, useAutomationQueue, useApiTokens } from '../chunk-Q63FQ7B5.js';
10
+ import { targetParam, variablesToSchema, schemaDefaults } from '../chunk-BUW45GM2.js';
11
+ import '../chunk-LAZ3RQ7X.js';
12
+ import { useClient, useAixConfig } from '../chunk-A5VNENHD.js';
13
+ import '../chunk-JTFZSFFA.js';
14
+ import '../chunk-B2BOVLI6.js';
15
15
  import '../chunk-NWFYTFMI.js';
16
16
  import { useState, useEffect, useMemo } from 'react';
17
17
  import { RefreshCw, Plug, Plus, X, Play, ChevronDown, ChevronRight, PlayCircle, Pause, Ban, Trash2, Webhook, MonitorSmartphone, Copy } from 'lucide-react';