alink-cli 0.11.6 → 0.11.7

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.
package/dist/ui.js CHANGED
@@ -48138,6 +48138,11 @@ var DAEMON_LOCK_FILE = join(
48138
48138
  "userdata",
48139
48139
  "daemon.lock"
48140
48140
  );
48141
+ function hubConnectionStatus(running, status, expectedHub) {
48142
+ if (!running) return "\u672A\u8FDE\u63A5";
48143
+ if (expectedHub && typeof status?.hub === "string" && normalizeHub(status.hub) !== normalizeHub(expectedHub)) return "\u672A\u8FDE\u63A5";
48144
+ return status?.hubConnected ? "\u5DF2\u8FDE\u63A5" : "\u8FDE\u63A5\u4E2D";
48145
+ }
48141
48146
  function normalizeHub(hub) {
48142
48147
  const url = new URL(hub);
48143
48148
  if (url.protocol === "http:") url.protocol = "ws:";
@@ -48349,9 +48354,6 @@ function loadConfig() {
48349
48354
  };
48350
48355
  }
48351
48356
  }
48352
- function saveConfig(config) {
48353
- writeFileSync2(CONFIG_FILE, JSON.stringify(config, null, 2));
48354
- }
48355
48357
  function quit(exit) {
48356
48358
  exit();
48357
48359
  process.exit(0);
@@ -48374,6 +48376,7 @@ function StatusBar({ running, status }) {
48374
48376
  const loggedIn = isLoggedIn(hub);
48375
48377
  const upTime = running && status?.startedAt ? formatDuration(Date.now() - status.startedAt) : void 0;
48376
48378
  const machineTag = status?.machineId ? status.machineId.slice(-6) : void 0;
48379
+ const hubStatus = hubConnectionStatus(running, status, hub);
48377
48380
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { flexDirection: "column", borderStyle: "round", borderColor: "cyan", paddingX: 1, marginBottom: 1, children: [
48378
48381
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { bold: true, color: "cyanBright", children: "\u25C6 AgentLink CLI" }),
48379
48382
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { gap: 2, children: [
@@ -48393,7 +48396,11 @@ function StatusBar({ running, status }) {
48393
48396
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { gap: 2, children: [
48394
48397
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { color: "gray", children: [
48395
48398
  "Hub: ",
48396
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: "blue", children: hub })
48399
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { color: hubStatus === "\u5DF2\u8FDE\u63A5" ? "green" : hubStatus === "\u8FDE\u63A5\u4E2D" ? "yellow" : "red", children: [
48400
+ hubStatus === "\u5DF2\u8FDE\u63A5" ? "\u25CF" : "\u25CB",
48401
+ " ",
48402
+ hubStatus
48403
+ ] })
48397
48404
  ] }),
48398
48405
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { color: "gray", children: [
48399
48406
  "\u8D26\u53F7: ",
@@ -48420,69 +48427,27 @@ function Menu({ items, selectedIndex }) {
48420
48427
  ] }, item.value);
48421
48428
  }) });
48422
48429
  }
48423
- function SimpleInput({ label, value, onChange, onSubmit, onCancel, mask }) {
48424
- use_input_default((input, key) => {
48425
- if (key.return) {
48426
- onSubmit();
48427
- return;
48428
- }
48429
- if (key.escape || key.ctrl && input === "c") {
48430
- onCancel();
48431
- return;
48432
- }
48433
- if (key.backspace || key.delete) {
48434
- onChange(value.slice(0, -1));
48435
- return;
48436
- }
48437
- if (input && !key.ctrl && !key.meta) {
48438
- onChange(value + input);
48439
- }
48440
- });
48441
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { flexDirection: "column", borderStyle: "round", borderColor: "cyan", paddingX: 1, children: [
48442
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { bold: true, color: "cyanBright", children: label }),
48443
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { color: "white", children: [
48444
- mask ? "*".repeat(value.length) : value,
48445
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: "cyanBright", children: "\u258F" })
48446
- ] }),
48447
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: "gray", children: "Enter \u786E\u8BA4 \xB7 Esc \u53D6\u6D88" })
48448
- ] });
48449
- }
48450
48430
  function StatusDetail({ status, running, onBack }) {
48451
48431
  const { exit } = use_app_default();
48432
+ const hubStatus = hubConnectionStatus(running, status);
48452
48433
  use_input_default((input, key) => {
48453
48434
  if (key.return || key.escape) onBack();
48454
48435
  if (key.ctrl && input === "c") quit(exit);
48455
48436
  });
48456
48437
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { flexDirection: "column", borderStyle: "round", borderColor: "cyan", paddingX: 1, children: [
48457
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { bold: true, color: "cyanBright", children: "\u25C6 Daemon \u72B6\u6001\u8BE6\u60C5" }),
48438
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { bold: true, color: "cyanBright", children: "\u25C6 AgentLink \u72B6\u6001" }),
48458
48439
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { color: "gray", children: [
48459
- "\u8FD0\u884C\u4E2D: ",
48460
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: running ? "green" : "red", children: running ? "\u662F" : "\u5426" })
48440
+ "\u672C\u673A\u670D\u52A1: ",
48441
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: running ? "green" : "red", children: running ? "\u8FD0\u884C\u4E2D" : "\u5DF2\u505C\u6B62" })
48442
+ ] }),
48443
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { color: "gray", children: [
48444
+ "Hub \u8FDE\u63A5: ",
48445
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: hubStatus === "\u5DF2\u8FDE\u63A5" ? "green" : hubStatus === "\u8FDE\u63A5\u4E2D" ? "yellow" : "red", children: hubStatus })
48461
48446
  ] }),
48462
- status?.pid ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { color: "gray", children: [
48463
- "PID: ",
48464
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: "white", children: status.pid })
48465
- ] }) : null,
48466
- status?.state ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { color: "gray", children: [
48467
- "State: ",
48468
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: "white", children: status.state })
48469
- ] }) : null,
48470
- status?.hub ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { color: "gray", children: [
48471
- "Hub: ",
48472
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: "blue", children: status.hub })
48473
- ] }) : null,
48474
- status?.machineId ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { color: "gray", children: [
48475
- "Machine ID: ",
48476
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: "white", children: status.machineId })
48477
- ] }) : null,
48478
48447
  status?.daemonVersion ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { color: "gray", children: [
48479
48448
  "\u7248\u672C: ",
48480
48449
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: "white", children: status.daemonVersion })
48481
48450
  ] }) : null,
48482
- status?.startedAt ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { color: "gray", children: [
48483
- "\u542F\u52A8\u65F6\u95F4: ",
48484
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: "white", children: new Date(status.startedAt).toLocaleString() })
48485
- ] }) : null,
48486
48451
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: "gray", dimColor: true, children: "\u6309 Enter / Esc \u8FD4\u56DE" })
48487
48452
  ] });
48488
48453
  }
@@ -48527,19 +48492,23 @@ function HelpView({ onBack }) {
48527
48492
  ] }),
48528
48493
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { color: "gray", children: [
48529
48494
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: "cyan", children: "\u2022" }),
48530
- " \u542F\u52A8\u540E daemon \u5728\u540E\u53F0\u8FD0\u884C\uFF0C\u9000\u51FA TUI \u4E0D\u5F71\u54CD\u5B83"
48531
- ] }),
48532
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { color: "gray", children: [
48533
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: "cyan", children: "\u2022" }),
48534
- " alink-cli status / login / logout / machines \u4ECD\u53EF\u547D\u4EE4\u884C\u4F7F\u7528"
48495
+ " \u9000\u51FA\u6B64\u754C\u9762\u540E\uFF0CAgentLink \u4ECD\u4F1A\u5728\u540E\u53F0\u8FD0\u884C"
48535
48496
  ] }),
48536
48497
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { color: "gray", children: [
48537
48498
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: "cyan", children: "\u2022" }),
48538
- " alink-cli --legacy \u8FD0\u884C\u65E7\u7248\u524D\u53F0 daemon"
48499
+ " alink-cli status \u53EF\u968F\u65F6\u67E5\u770B\u8FDE\u63A5\u72B6\u6001"
48539
48500
  ] }),
48540
48501
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: "gray", dimColor: true, children: "\u6309 Enter / Esc \u8FD4\u56DE" })
48541
48502
  ] });
48542
48503
  }
48504
+ async function waitForHubConnection(hub, timeoutMs = 15e3, pollMs = 200) {
48505
+ const deadline = Date.now() + timeoutMs;
48506
+ while (Date.now() < deadline) {
48507
+ if (hubConnectionStatus(isDaemonRunning(), readDaemonStatus(), hub) === "\u5DF2\u8FDE\u63A5") return true;
48508
+ await new Promise((resolve2) => setTimeout(resolve2, pollMs));
48509
+ }
48510
+ return false;
48511
+ }
48543
48512
  function App2() {
48544
48513
  const { exit } = use_app_default();
48545
48514
  const [running, setRunning] = (0, import_react22.useState)(isDaemonRunning());
@@ -48548,9 +48517,6 @@ function App2() {
48548
48517
  const [selectedIndex, setSelectedIndex] = (0, import_react22.useState)(0);
48549
48518
  const [message, setMessage] = (0, import_react22.useState)("");
48550
48519
  const [confirmAction, setConfirmAction] = (0, import_react22.useState)(null);
48551
- const [config, setConfig] = (0, import_react22.useState)(loadConfig());
48552
- const [inputValue, setInputValue] = (0, import_react22.useState)("");
48553
- const [settingsField, setSettingsField] = (0, import_react22.useState)(null);
48554
48520
  const [reconnecting, setReconnecting] = (0, import_react22.useState)(false);
48555
48521
  const [authTick, setAuthTick] = (0, import_react22.useState)(0);
48556
48522
  (0, import_react22.useEffect)(() => {
@@ -48562,12 +48528,13 @@ function App2() {
48562
48528
  }, []);
48563
48529
  const menuItems = (0, import_react22.useMemo)(() => {
48564
48530
  void authTick;
48565
- const loggedIn = isLoggedIn(loadConfig().hub);
48531
+ const config = loadConfig();
48532
+ const loggedIn = isLoggedIn(config.hub);
48566
48533
  const items = [];
48567
48534
  if (!running) {
48568
- items.push({ label: "\u542F\u52A8 daemon", value: "start" });
48535
+ items.push({ label: "\u542F\u52A8 AgentLink", value: "start" });
48569
48536
  } else {
48570
- items.push({ label: "\u505C\u6B62 daemon", value: "stop" });
48537
+ items.push({ label: "\u505C\u6B62 AgentLink", value: "stop" });
48571
48538
  items.push({ label: "\u91CD\u65B0\u8FDE\u63A5 AgentLink", value: "restart" });
48572
48539
  }
48573
48540
  items.push({ label: "\u67E5\u770B\u72B6\u6001\u8BE6\u60C5", value: "status" });
@@ -48575,7 +48542,6 @@ function App2() {
48575
48542
  const isOfficialHub = normalizeHub(config.hub) === normalizeHub(OFFICIAL_HUB);
48576
48543
  if (!loggedIn && !isOfficialHub) items.push({ label: "\u514D\u767B\u5F55\u914D\u5BF9\uFF08\u65E0\u9700\u8D26\u53F7\uFF0C\u7AEF\u5230\u7AEF\u52A0\u5BC6\uFF09", value: "pair" });
48577
48544
  items.push({ label: "\u67E5\u770B\u673A\u5668", value: "machines", disabled: !loggedIn });
48578
- items.push({ label: "\u8BBE\u7F6E", value: "settings" });
48579
48545
  items.push({ label: "\u5E2E\u52A9", value: "help" });
48580
48546
  items.push({ label: "\u9000\u51FA TUI", value: "exit" });
48581
48547
  return items;
@@ -48613,7 +48579,7 @@ function App2() {
48613
48579
  switch (value) {
48614
48580
  case "start": {
48615
48581
  if (running) {
48616
- setNotice("daemon \u5DF2\u5728\u8FD0\u884C");
48582
+ setNotice("AgentLink \u5DF2\u5728\u8FD0\u884C");
48617
48583
  return;
48618
48584
  }
48619
48585
  const credential = readCredential(cfg.hub);
@@ -48634,7 +48600,7 @@ function App2() {
48634
48600
  approval: cfg.approval,
48635
48601
  approvalRenotifyMin: cfg.approvalRenotifyMin
48636
48602
  });
48637
- setNotice(`daemon \u5DF2\u540E\u53F0\u542F\u52A8 (PID ${pid})`);
48603
+ setNotice("AgentLink \u5DF2\u5728\u540E\u53F0\u542F\u52A8");
48638
48604
  setRunning(true);
48639
48605
  } catch (err) {
48640
48606
  setNotice(`\u542F\u52A8\u5931\u8D25: ${err instanceof Error ? err.message : String(err)}`);
@@ -48643,7 +48609,7 @@ function App2() {
48643
48609
  }
48644
48610
  case "stop": {
48645
48611
  if (!running) {
48646
- setNotice("daemon \u672A\u8FD0\u884C");
48612
+ setNotice("AgentLink \u672A\u8FD0\u884C");
48647
48613
  return;
48648
48614
  }
48649
48615
  setConfirmAction({ type: "stop" });
@@ -48672,10 +48638,6 @@ function App2() {
48672
48638
  setView("machines");
48673
48639
  return;
48674
48640
  }
48675
- case "settings": {
48676
- setView("settings");
48677
- return;
48678
- }
48679
48641
  case "help": {
48680
48642
  setView("help");
48681
48643
  return;
@@ -48692,7 +48654,7 @@ function App2() {
48692
48654
  if (confirmAction.type === "stop") {
48693
48655
  stopDaemon().then(() => {
48694
48656
  setRunning(false);
48695
- setNotice("daemon \u5DF2\u505C\u6B62");
48657
+ setNotice("AgentLink \u5DF2\u505C\u6B62");
48696
48658
  }).catch((err) => setNotice(`\u505C\u6B62\u5931\u8D25: ${err instanceof Error ? err.message : String(err)}`));
48697
48659
  } else if (confirmAction.type === "restart") {
48698
48660
  const credential = readCredential(cfg.hub);
@@ -48706,15 +48668,17 @@ function App2() {
48706
48668
  setConfirmAction(null);
48707
48669
  setReconnecting(true);
48708
48670
  try {
48709
- const pid = await restartDaemon({
48671
+ await restartDaemon({
48710
48672
  hub: cfg.hub,
48711
48673
  credential,
48712
48674
  cwd: cfg.dir,
48713
48675
  approval: cfg.approval,
48714
48676
  approvalRenotifyMin: cfg.approvalRenotifyMin
48715
48677
  });
48716
- setNotice(`AgentLink \u5DF2\u5F00\u59CB\u91CD\u65B0\u8FDE\u63A5 (PID ${pid})`);
48717
48678
  setRunning(true);
48679
+ const connected = await waitForHubConnection(cfg.hub);
48680
+ setStatus(readDaemonStatus());
48681
+ setNotice(connected ? "AgentLink \u5DF2\u91CD\u65B0\u8FDE\u63A5" : "AgentLink \u5DF2\u542F\u52A8\uFF0CHub \u6B63\u5728\u540E\u53F0\u7EE7\u7EED\u8FDE\u63A5");
48718
48682
  } catch (err) {
48719
48683
  setNotice(`\u91CD\u65B0\u8FDE\u63A5\u5931\u8D25: ${err instanceof Error ? err.message : String(err)}`);
48720
48684
  } finally {
@@ -48725,7 +48689,7 @@ function App2() {
48725
48689
  clearCredential();
48726
48690
  setRunning(false);
48727
48691
  setAuthTick((t) => t + 1);
48728
- setNotice("\u5DF2\u9000\u51FA\u8D26\u53F7\u5E76\u505C\u6B62 daemon");
48692
+ setNotice("\u5DF2\u9000\u51FA\u8D26\u53F7\u5E76\u505C\u6B62 AgentLink");
48729
48693
  }
48730
48694
  setView("menu");
48731
48695
  setConfirmAction(null);
@@ -48738,7 +48702,7 @@ function App2() {
48738
48702
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
48739
48703
  ConfirmDialog,
48740
48704
  {
48741
- title: confirmAction?.type === "stop" ? "\u786E\u5B9A\u8981\u505C\u6B62 daemon \u5417\uFF1F" : confirmAction?.type === "restart" ? "\u786E\u5B9A\u8981\u91CD\u65B0\u8FDE\u63A5 AgentLink \u5417\uFF1F" : "\u786E\u5B9A\u8981\u9000\u51FA\u8D26\u53F7\u5417\uFF1F\u9000\u51FA\u540E\u4F1A\u505C\u6B62 daemon\u3002",
48705
+ title: confirmAction?.type === "stop" ? "\u786E\u5B9A\u8981\u505C\u6B62 AgentLink \u5417\uFF1F" : confirmAction?.type === "restart" ? "\u786E\u5B9A\u8981\u91CD\u65B0\u8FDE\u63A5 AgentLink \u5417\uFF1F" : "\u786E\u5B9A\u8981\u9000\u51FA\u8D26\u53F7\u5417\uFF1F\u9000\u51FA\u540E\u4F1A\u505C\u6B62 AgentLink\u3002",
48742
48706
  onConfirm: handleConfirm,
48743
48707
  onCancel: () => {
48744
48708
  setView("menu");
@@ -48748,19 +48712,6 @@ function App2() {
48748
48712
  );
48749
48713
  case "help":
48750
48714
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(HelpView, { onBack: () => setView("menu") });
48751
- case "settings":
48752
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
48753
- SettingsPanel,
48754
- {
48755
- config,
48756
- onChange: setConfig,
48757
- field: settingsField,
48758
- setField: setSettingsField,
48759
- inputValue,
48760
- setInputValue,
48761
- onBack: () => setView("menu")
48762
- }
48763
- );
48764
48715
  case "login":
48765
48716
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
48766
48717
  LoginView,
@@ -48789,7 +48740,7 @@ function App2() {
48789
48740
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MachinesView, { onDone: () => setView("menu") });
48790
48741
  case "menu":
48791
48742
  default:
48792
- if (reconnecting) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Loading, { label: "\u6B63\u5728\u91CD\u65B0\u8FDE\u63A5 AgentLink..." });
48743
+ if (reconnecting) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Loading, { label: "\u6B63\u5728\u91CD\u542F\u5E76\u8FDE\u63A5 Hub..." });
48793
48744
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box_default, { flexDirection: "column", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Menu, { items: menuItems, selectedIndex }) });
48794
48745
  }
48795
48746
  }
@@ -48802,79 +48753,6 @@ function App2() {
48802
48753
  ] }) }) : null
48803
48754
  ] });
48804
48755
  }
48805
- function SettingsPanel({
48806
- config,
48807
- onChange,
48808
- field,
48809
- setField,
48810
- inputValue,
48811
- setInputValue,
48812
- onBack
48813
- }) {
48814
- const [selected, setSelected] = (0, import_react22.useState)(0);
48815
- const options = [
48816
- { label: `Hub URL: ${config.hub}`, value: "hub" },
48817
- { label: `\u5DE5\u4F5C\u76EE\u5F55: ${config.dir}`, value: "dir" },
48818
- { label: `\u5BA1\u6279\u6A21\u5F0F: ${config.approval ? "\u5F00\u542F" : "\u5173\u95ED"}`, value: "approval" },
48819
- { label: `\u5BA1\u6279\u91CD\u901A\u77E5: ${config.approvalRenotifyMin} \u5206\u949F`, value: "approvalRenotifyMin" },
48820
- { label: "\u8FD4\u56DE", value: "back" }
48821
- ];
48822
- use_input_default((input, key) => {
48823
- if (field) return;
48824
- if (key.upArrow || input === "k") {
48825
- setSelected((s) => s <= 0 ? options.length - 1 : s - 1);
48826
- } else if (key.downArrow || input === "j") {
48827
- setSelected((s) => s >= options.length - 1 ? 0 : s + 1);
48828
- } else if (key.return) {
48829
- const opt = options[selected];
48830
- if (opt.value === "back") {
48831
- onBack();
48832
- } else if (opt.value === "approval") {
48833
- const next = { ...config, approval: !config.approval };
48834
- onChange(next);
48835
- saveConfig(next);
48836
- } else if (opt.value === "hub" || opt.value === "dir" || opt.value === "approvalRenotifyMin") {
48837
- setField(opt.value);
48838
- setInputValue(
48839
- opt.value === "approvalRenotifyMin" ? String(config.approvalRenotifyMin) : config[opt.value]
48840
- );
48841
- }
48842
- } else if (key.escape || key.ctrl && input === "c") {
48843
- onBack();
48844
- }
48845
- });
48846
- if (field) {
48847
- const label = field === "hub" ? "Hub URL (\u4F8B\u5982 wss://link.harmopath.com):" : field === "dir" ? "\u9ED8\u8BA4\u5DE5\u4F5C\u76EE\u5F55:" : "\u5BA1\u6279\u91CD\u901A\u77E5\u95F4\u9694 (\u5206\u949F\uFF0C0=\u5173\u95ED):";
48848
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
48849
- SimpleInput,
48850
- {
48851
- label,
48852
- value: inputValue,
48853
- onChange: setInputValue,
48854
- onSubmit: () => {
48855
- const next = { ...config };
48856
- if (field === "approvalRenotifyMin") {
48857
- const n = Number(inputValue);
48858
- if (Number.isInteger(n) && n >= 0) next.approvalRenotifyMin = n;
48859
- } else {
48860
- next[field] = inputValue;
48861
- }
48862
- onChange(next);
48863
- saveConfig(next);
48864
- setField(null);
48865
- },
48866
- onCancel: () => setField(null)
48867
- }
48868
- );
48869
- }
48870
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { flexDirection: "column", borderStyle: "round", borderColor: "cyan", paddingX: 1, children: [
48871
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { bold: true, color: "cyanBright", children: "\u25C6 \u8BBE\u7F6E" }),
48872
- options.map((opt, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { bold: i === selected, color: i === selected ? "cyanBright" : "white", children: [
48873
- i === selected ? "\u276F " : " ",
48874
- opt.label
48875
- ] }, opt.value))
48876
- ] });
48877
- }
48878
48756
  function runDetachedScript(args, options = {}) {
48879
48757
  return new Promise((resolve2) => {
48880
48758
  const binPath = fileURLToPath2(new URL("../bin/agentlink.js", import.meta.url));
@@ -49089,7 +48967,7 @@ function MachinesView({ onDone }) {
49089
48967
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: "gray", dimColor: true, children: "\u6309 Esc \u8FD4\u56DE \xB7 Ctrl+C \u9000\u51FA" })
49090
48968
  ] });
49091
48969
  }
49092
- if (process.env.AGENTLINK_RENDER_TUI === "1") {
48970
+ if (process.env.AGENTLINK_RENDER_TUI === "1" && process.stdin.isTTY) {
49093
48971
  render_default(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(App2, {}));
49094
48972
  }
49095
48973
  export {
@@ -49104,7 +48982,8 @@ export {
49104
48982
  restartDaemon,
49105
48983
  saveCredential,
49106
48984
  startDaemon,
49107
- stopDaemon
48985
+ stopDaemon,
48986
+ waitForHubConnection
49108
48987
  };
49109
48988
  /*! Bundled license information:
49110
48989
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alink-cli",
3
- "version": "0.11.6",
3
+ "version": "0.11.7",
4
4
  "description": "一条命令把工作机接入 AgentLink,随时随地遥控本机的编码 agent。One command to link your machine to AgentLink and control your coding agents from anywhere.",
5
5
  "keywords": [
6
6
  "acp",
@@ -21,6 +21,7 @@
21
21
  },
22
22
  "bin": {
23
23
  "agentlink": "bin/agentlink.js",
24
+ "alink": "bin/agentlink.js",
24
25
  "alink-cli": "bin/agentlink.js"
25
26
  },
26
27
  "files": [