mindwire 0.1.52 → 0.1.53

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/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { enableAddressDiscovery, disableAddressDiscovery, discoveryDescription, connectionAddress, saveDiscoveryPreference, discoveryPreference, reconcileAddressDiscovery, connectionInfo, connectionDescription, updateComputer, updateProgress, activeUpdate } from './chunk-RTMQJIKW.js';
3
- import { SDK_VERSION, defaultStateDirectory, computerClient, superviseComputer, ensureComputer, readJSON, defaultComputerConfig, computerPairingURI, stopComputer, processStateAlive, providerFailure, acquireProcessLock, writeJSON, currentProcessIdentity, CONTROLLER_PROTOCOL, versionAtLeast, websocketURL, providerNeedsAction, cloudflareCommand, computerPairingQRData, ProviderConnectionError } from './chunk-4XL565EU.js';
2
+ import { enableAddressDiscovery, disableAddressDiscovery, discoveryDescription, connectionAddress, saveDiscoveryPreference, discoveryPreference, reconcileAddressDiscovery, connectionInfo, updateComputer, updateProgress, activeUpdate } from './chunk-MZ4OTZFH.js';
3
+ import { SDK_VERSION, defaultStateDirectory, computerClient, superviseComputer, ensureComputer, readJSON, defaultComputerConfig, computerPairingURI, stopComputer, processStateAlive, providerFailure, acquireProcessLock, writeJSON, currentProcessIdentity, CONTROLLER_PROTOCOL, versionAtLeast, websocketURL, providerNeedsAction, cloudflareCommand, computerPairingQRData, ProviderConnectionError } from './chunk-O5DWL7MH.js';
4
4
  import { ApiError } from './chunk-PFYKJ6LX.js';
5
5
  import { promisify, parseArgs } from 'util';
6
6
  import { fileURLToPath, pathToFileURL } from 'url';
@@ -22,7 +22,7 @@ var enterScreen = "\x1B[?1049h\x1B[?25l";
22
22
  var leaveScreen = "\x1B[0m\x1B[?25h\x1B[?1049l";
23
23
  var clearScreen = "\x1B[H\x1B[2J";
24
24
  function scanInstruction(invitation) {
25
- return "mode" in invitation && invitation.mode === "reconnect" ? "Workspaces \u2192 your computer \u2192 Reconnect Computer \u2192 Scan Connection Code" : "Mindwire \u2192 Add computer \u2192 Scan QR code";
25
+ return "mode" in invitation && invitation.mode === "reconnect" ? "Workspaces \u2192 your computer \u2192 Reconnect Computer \u2192 Scan Connection Code" : "In Mindwire on your phone, tap Scan QR code.";
26
26
  }
27
27
  async function createPairingQR(invitation) {
28
28
  const QR = await import('qrcode');
@@ -67,15 +67,15 @@ textarea{width:100%;margin-top:12px;padding:8px;color:inherit;background:#252528
67
67
  <small>MINDWIRE</small><h1>${title}</h1><p>${escapeHTML(invitation.name)}</p>
68
68
  <div class="code" id="code" role="img" aria-label="Mindwire connection QR code">${svg}</div>
69
69
  <p id="expiry" data-expires="${escapeHTML(invitation.expiresAt)}" aria-live="off"></p>
70
- <div class="steps"><p>${reconnect ? "In Mindwire, open your computer in <strong>Workspaces</strong>, then <strong>Reconnect Computer \u2192 Scan Connection Code</strong>." : "In Mindwire, open <strong>Add computer</strong> and scan."}</p>
71
- <p>${reconnect ? "Your saved pairing and workspace stay the same. No new approval is needed." : "Saved keys reconnect automatically. Approve on this computer only if asked."}</p></div>
70
+ <div class="steps"><p>${reconnect ? "In Mindwire, open your computer in <strong>Workspaces</strong>, then <strong>Reconnect Computer \u2192 Scan Connection Code</strong>." : "In Mindwire on your phone, tap <strong>Scan QR code</strong>."}</p>
71
+ <p>${reconnect ? "Your saved pairing stays the same." : "Then approve your phone in the terminal."}</p></div>
72
72
  <button type="button" id="copy">Copy ${reconnect ? "reconnect" : "pairing"} link</button>
73
73
  <textarea id="link" readonly hidden aria-label="Pairing link">${escapeHTML(computerPairingURI(invitation))}</textarea>
74
74
  <footer>You can close this page after ${reconnect ? "reconnecting" : "pairing"}.</footer>
75
75
  </main><script>
76
76
  const expiry=document.getElementById('expiry'),code=document.getElementById('code'),copy=document.getElementById('copy'),link=document.getElementById('link');
77
77
  function tick(){const seconds=Math.max(0,Math.ceil((Date.parse(expiry.dataset.expires)-Date.now())/1000));
78
- if(!seconds){code.remove();copy.disabled=true;link.value='';link.hidden=true;expiry.textContent='Code expired. Run mindwire connect for a new code.';return;}
78
+ if(!seconds){code.remove();copy.disabled=true;link.value='';link.hidden=true;expiry.textContent='Code expired. Run mindwire connect pair for a new code.';return;}
79
79
  expiry.textContent='Expires in '+Math.floor(seconds/60)+':'+String(seconds%60).padStart(2,'0');}
80
80
  tick();setInterval(tick,1000);
81
81
  copy.addEventListener('click',async()=>{try{await navigator.clipboard.writeText(link.value);copy.textContent='Copied';}
@@ -103,7 +103,7 @@ async function showPairingInvitation(invitation, options = {}) {
103
103
  const instruction = scanInstruction(invitation);
104
104
  const nextStep = reconnect ? "Scan with a saved phone." : "Approve on this computer only if asked.";
105
105
  const waiting = reconnect ? "Your saved pairing stays the same." : "Waiting for your phone\u2026";
106
- const command = "mindwire connect";
106
+ const command = "mindwire connect pair";
107
107
  const output = options.output ?? process.stdout;
108
108
  const environment = options.environment ?? process.env;
109
109
  const mode = options.mode ?? "auto";
@@ -1229,8 +1229,8 @@ async function computerDashboard(directory, run2) {
1229
1229
  const saved = state.devices.filter((device) => !device.revoked);
1230
1230
  const running = state.service === "running";
1231
1231
  const action = await chooseTerminal([...inspectionText(state).split("\n"), "", "Manage this computer"], [
1232
- { value: "reconnect", label: running ? "Reconnect" : "Start connection" },
1233
- { value: "pair", label: "Pair or repair a phone" },
1232
+ { value: "pair", label: "Show QR code \xB7 connect a phone" },
1233
+ { value: "reconnect", label: running ? "Retry saved connections" : "Start connection" },
1234
1234
  { value: "devices", label: `Phones${saved.length ? ` \xB7 ${saved.length} paired` : ""}` },
1235
1235
  { value: "startup", label: `Start at login \xB7 ${state.startup.enabled ? state.startup.running ? "On" : "Needs repair" : "Off"}` },
1236
1236
  { value: "connection", label: "Connection provider" },
@@ -1261,7 +1261,7 @@ async function computerDashboard(directory, run2) {
1261
1261
  break;
1262
1262
  case "devices": {
1263
1263
  if (!saved.length) {
1264
- process.stdout.write("No paired phones. Choose Pair or repair a phone to connect one.\n");
1264
+ process.stdout.write("No paired phones. Choose Show QR code to connect one.\n");
1265
1265
  break;
1266
1266
  }
1267
1267
  const id = await chooseTerminal("Paired phones", saved.map((device2) => ({ value: device2.id, label: deviceSummary([device2], true).trim() })));
@@ -1324,7 +1324,6 @@ async function computerDashboard(directory, run2) {
1324
1324
  process.stderr.write(`Mindwire: ${terminalText(error instanceof Error ? error.message : String(error))}
1325
1325
  `);
1326
1326
  }
1327
- if (!await chooseTerminal("", [{ value: "continue", label: "Back to Mindwire" }])) return;
1328
1327
  }
1329
1328
  }
1330
1329
  function desktopSummary(info) {
@@ -1423,7 +1422,7 @@ var help = `Mindwire \u2014 connect this computer to your phone
1423
1422
  mindwire Interactive status and connection controls
1424
1423
  mindwire connect Connect your phone; saved keys reconnect automatically
1425
1424
  mindwire reconnect Retry the saved connection
1426
- mindwire connect pair Pair a phone, or repair a lost phone key/address
1425
+ mindwire connect pair Show a QR code to pair or reconnect a phone
1427
1426
  mindwire connection Choose a persistent connection provider
1428
1427
  mindwire connection automatic Cloudflare traffic with encrypted Mindwire address recovery
1429
1428
  mindwire connection oblien Sign in and use an Oblien tunnel
@@ -1652,18 +1651,18 @@ async function main(args = process.argv.slice(2)) {
1652
1651
  }
1653
1652
  const info = await client2.computer.info();
1654
1653
  const connection = connectionInfo(savedConfig?.relay ?? { kind: "cloudflare" }, savedConfig?.host);
1655
- emit("ready", { computerId: info.computerId, routes: info.routes, connection }, "Mindwire is running in the background.");
1656
- emit("connection", connection, info.discovery?.enabled && connection.address === "temporary" ? "Cloudflare \xB7 encrypted Mindwire address recovery" : connectionDescription(connection));
1654
+ emit("ready", { computerId: info.computerId, routes: info.routes, connection }, "Mindwire is running.");
1655
+ emit("connection", connection);
1657
1656
  if (command === "start") return;
1658
1657
  if (info.routes.some((route) => route.kind === "websocket")) {
1659
- emit("secure_connection", {}, "Your phone connects over end-to-end encrypted SSH. The tunnel carries encrypted traffic; only phones you approve can connect.");
1658
+ emit("secure_connection");
1660
1659
  }
1661
1660
  const devices = await client2.computer.devices();
1662
1661
  const saved = devices.filter((device) => !device.revoked);
1663
1662
  if (addressChanged && !saved.some((device) => device.addressRecovery)) requestedAction = "pair";
1664
- if (info.discovery?.enabled) emit("discovery", info.discovery, discoveryDescription(info.discovery));
1663
+ if (info.discovery?.enabled) emit("discovery", info.discovery);
1665
1664
  if (saved.length) emit("saved_devices", { devices: saved }, `
1666
- Saved approvals on this computer
1665
+ Saved phones
1667
1666
  ${deviceSummary(saved)}`);
1668
1667
  const question2 = !values.json && process.stdin.isTTY ? async (prompt) => {
1669
1668
  const input = createInterface({ input: process.stdin, output: process.stderr });
@@ -1684,21 +1683,18 @@ ${deviceSummary(saved)}`);
1684
1683
  if (startupAction !== void 0) {
1685
1684
  try {
1686
1685
  const startup = await configureStartup(directory, fileURLToPath(import.meta.url), startupAction);
1687
- emit("startup", startup, startup.enabled ? "Automatic startup enabled. Saved phones can reconnect after you sign in to this computer." : "Automatic startup is off. Run mindwire connect after restarting, or mindwire startup enable to change this.");
1686
+ emit("startup", startup, startup.enabled ? "Start at login: On" : "Start at login: Off. Enable with mindwire startup enable.");
1688
1687
  } catch {
1689
1688
  emit("startup_unavailable", {}, "Mindwire is running, but startup setup didn't complete. Run mindwire startup enable to check your system's startup service.");
1690
1689
  }
1691
1690
  } else {
1692
- emit("startup", startupPreference, startupPreference.enabled ? startupPreference.running ? "Automatic startup is on. Change it with mindwire startup disable." : "Automatic startup needs repair. Run mindwire startup repair." : "Automatic startup is off. Enable it with mindwire startup enable.");
1691
+ emit("startup", startupPreference, startupPreference.enabled ? startupPreference.running ? "Start at login: On" : "Automatic startup needs repair. Run mindwire startup repair." : "Start at login: Off. Enable with mindwire startup enable.");
1693
1692
  }
1694
1693
  if (action === "resume") {
1695
1694
  const connected = saved.filter((device) => device.connected);
1696
- if (connected.length) emit("connected", { computerId: info.computerId, devices: connected }, `
1697
- Connected:
1698
- ${deviceSummary(connected)}
1699
- Mindwire continues running in the background.`);
1700
- else emit("waiting_for_phone", { computerId: info.computerId }, "\nReady for your saved phone. Open Mindwire; it will retry this computer's saved connection.");
1701
- emit("connect_hint", {}, "If the connection was removed from your phone, run mindwire connect pair to scan again.");
1695
+ if (connected.length) emit("connected", { computerId: info.computerId, devices: connected }, "\nYour phone is connected.");
1696
+ else emit("waiting_for_phone", { computerId: info.computerId }, "\nOpen Mindwire on your phone and choose your saved computer.");
1697
+ emit("connect_hint", {}, "Need a QR code? Run mindwire connect pair.");
1702
1698
  return;
1703
1699
  }
1704
1700
  const invitation = await client2.computer.invite((await client2.computer.info()).routes);