claudemesh-cli 1.0.0-alpha.3 → 1.0.0-alpha.5

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.
@@ -278,21 +278,6 @@ var init_my = __esm(() => {
278
278
  });
279
279
 
280
280
  // src/services/api/public.ts
281
- var exports_public = {};
282
- __export(exports_public, {
283
- requestDeviceCode: () => requestDeviceCode,
284
- pollDeviceCode: () => pollDeviceCode,
285
- claimInvite: () => claimInvite
286
- });
287
- async function claimInvite(code, body) {
288
- return post(`/api/public/invites/${code}/claim`, body);
289
- }
290
- async function requestDeviceCode(deviceInfo) {
291
- return post("/api/auth/cli/device-code/new", deviceInfo);
292
- }
293
- async function pollDeviceCode(deviceCode) {
294
- return get(`/api/auth/cli/device-code/${deviceCode}`);
295
- }
296
281
  var init_public = __esm(() => {
297
282
  init_client();
298
283
  });
@@ -305,24 +290,6 @@ var init_facade2 = __esm(() => {
305
290
  init_public();
306
291
  });
307
292
 
308
- // src/services/device/info.ts
309
- import { hostname, platform, arch, release } from "node:os";
310
- function getDeviceInfo() {
311
- return {
312
- hostname: hostname(),
313
- platform: platform(),
314
- arch: arch(),
315
- osRelease: release(),
316
- nodeVersion: process.version
317
- };
318
- }
319
- var init_info = () => {};
320
-
321
- // src/services/device/facade.ts
322
- var init_facade3 = __esm(() => {
323
- init_info();
324
- });
325
-
326
293
  // src/services/spawn/claude.ts
327
294
  import { spawnSync } from "node:child_process";
328
295
  import { existsSync } from "node:fs";
@@ -356,10 +323,10 @@ var init_claude = () => {};
356
323
 
357
324
  // src/services/spawn/browser.ts
358
325
  import { execFile } from "node:child_process";
359
- import { platform as platform2 } from "node:os";
326
+ import { platform } from "node:os";
360
327
  function openBrowser(url) {
361
328
  return new Promise((resolve, reject) => {
362
- const os = platform2();
329
+ const os = platform();
363
330
  let bin;
364
331
  let args;
365
332
  if (os === "darwin") {
@@ -389,7 +356,7 @@ __export(exports_facade, {
389
356
  openBrowser: () => openBrowser,
390
357
  findClaudeBinary: () => findClaudeBinary
391
358
  });
392
- var init_facade4 = __esm(() => {
359
+ var init_facade3 = __esm(() => {
393
360
  init_claude();
394
361
  init_browser();
395
362
  });
@@ -457,7 +424,7 @@ var init_read = __esm(() => {
457
424
 
458
425
  // src/services/config/write.ts
459
426
  import { writeFileSync, mkdirSync, chmodSync, openSync, closeSync, renameSync } from "node:fs";
460
- import { platform as platform3 } from "node:os";
427
+ import { platform as platform2 } from "node:os";
461
428
  function ensureConfigDir() {
462
429
  mkdirSync(PATHS.CONFIG_DIR, { recursive: true });
463
430
  if (!isWindows) {
@@ -510,7 +477,7 @@ var isWindows;
510
477
  var init_write = __esm(() => {
511
478
  init_paths();
512
479
  init_read();
513
- isWindows = platform3() === "win32";
480
+ isWindows = platform2() === "win32";
514
481
  });
515
482
 
516
483
  // src/services/config/facade.ts
@@ -528,7 +495,7 @@ __export(exports_facade2, {
528
495
  function getConfigPath() {
529
496
  return PATHS.CONFIG_FILE;
530
497
  }
531
- var init_facade5 = __esm(() => {
498
+ var init_facade4 = __esm(() => {
532
499
  init_read();
533
500
  init_write();
534
501
  init_paths();
@@ -565,9 +532,69 @@ function clearToken() {
565
532
  }
566
533
  var init_token_store = __esm(() => {
567
534
  init_paths();
568
- init_facade5();
535
+ init_facade4();
569
536
  });
570
537
 
538
+ // src/services/auth/callback-listener.ts
539
+ import { createServer } from "node:http";
540
+ function startCallbackListener() {
541
+ return new Promise((resolveStart) => {
542
+ let resolveToken;
543
+ let resolved = false;
544
+ const tokenPromise = new Promise((r) => {
545
+ resolveToken = r;
546
+ });
547
+ const server = createServer((req, res) => {
548
+ const url = new URL(req.url, "http://localhost");
549
+ if (req.method === "OPTIONS") {
550
+ res.writeHead(204, {
551
+ "Access-Control-Allow-Origin": "https://claudemesh.com",
552
+ "Access-Control-Allow-Methods": "GET",
553
+ "Access-Control-Allow-Headers": "Content-Type"
554
+ });
555
+ res.end();
556
+ return;
557
+ }
558
+ if (url.pathname === "/ping") {
559
+ res.writeHead(200, {
560
+ "Content-Type": "text/plain",
561
+ "Access-Control-Allow-Origin": "https://claudemesh.com"
562
+ });
563
+ res.end("ok");
564
+ return;
565
+ }
566
+ if (url.pathname === "/callback") {
567
+ const token = url.searchParams.get("token");
568
+ if (token && !resolved) {
569
+ resolved = true;
570
+ res.writeHead(200, {
571
+ "Content-Type": "text/html",
572
+ "Access-Control-Allow-Origin": "https://claudemesh.com"
573
+ });
574
+ res.end("<html><body><h2>Done! You can close this tab.</h2></body></html>");
575
+ resolveToken(token);
576
+ setTimeout(() => server.close(), 500);
577
+ } else {
578
+ res.writeHead(400, { "Content-Type": "text/plain" });
579
+ res.end("Missing token");
580
+ }
581
+ return;
582
+ }
583
+ res.writeHead(404);
584
+ res.end();
585
+ });
586
+ server.listen(0, "127.0.0.1", () => {
587
+ const addr = server.address();
588
+ resolveStart({
589
+ port: addr.port,
590
+ token: tokenPromise,
591
+ close: () => server.close()
592
+ });
593
+ });
594
+ });
595
+ }
596
+ var init_callback_listener = () => {};
597
+
571
598
  // src/services/auth/errors.ts
572
599
  var AuthError, DeviceCodeExpired, NotSignedIn;
573
600
  var init_errors2 = __esm(() => {
@@ -591,55 +618,55 @@ var init_errors2 = __esm(() => {
591
618
 
592
619
  // src/services/auth/device-code.ts
593
620
  async function loginWithDeviceCode() {
594
- const device = getDeviceInfo();
595
- const { device_code, user_code, verification_url } = await exports_public.requestDeviceCode({
596
- hostname: device.hostname,
597
- platform: device.platform,
598
- arch: device.arch
599
- });
621
+ const listener = await startCallbackListener();
622
+ const authUrl = `${URLS.API_BASE}/cli-auth?port=${listener.port}`;
600
623
  log(`
601
624
  Opening browser for sign-in…
602
625
  `);
603
626
  log(` If your browser didn't open, visit:`);
604
- log(` ${verification_url}?code=${user_code}
627
+ log(` ${authUrl}
605
628
  `);
606
629
  log(` Waiting for confirmation…
607
630
  `);
608
631
  try {
609
- await openBrowser(`${verification_url}?code=${user_code}`);
632
+ await openBrowser(authUrl);
610
633
  } catch {
611
634
  warn("Could not open browser automatically.");
612
635
  }
613
- const startTime = Date.now();
614
- while (Date.now() - startTime < TIMINGS.DEVICE_CODE_TIMEOUT_MS) {
615
- await new Promise((r) => setTimeout(r, TIMINGS.DEVICE_CODE_POLL_MS));
616
- let poll;
617
- try {
618
- poll = await exports_public.pollDeviceCode(device_code);
619
- } catch {
620
- continue;
621
- }
622
- if (poll.status === "approved" && poll.session_token && poll.user) {
623
- storeToken({
624
- session_token: poll.session_token,
625
- user: poll.user,
626
- token_source: "device-code"
627
- });
628
- return { user: poll.user, session_token: poll.session_token };
629
- }
630
- if (poll.status === "expired") {
631
- throw new DeviceCodeExpired;
632
- }
636
+ let token;
637
+ try {
638
+ token = await Promise.race([
639
+ listener.token,
640
+ new Promise((_, reject) => setTimeout(() => reject(new DeviceCodeExpired), 5 * 60 * 1000))
641
+ ]);
642
+ } finally {
643
+ listener.close();
633
644
  }
634
- throw new DeviceCodeExpired;
645
+ let user = { id: "", display_name: "", email: "" };
646
+ try {
647
+ const parts = token.split(".");
648
+ if (parts[1]) {
649
+ const payload = JSON.parse(Buffer.from(parts[1], "base64url").toString());
650
+ user = {
651
+ id: payload.sub ?? "",
652
+ display_name: payload.name ?? payload.email ?? "",
653
+ email: payload.email ?? ""
654
+ };
655
+ }
656
+ } catch {}
657
+ storeToken({
658
+ session_token: token,
659
+ user,
660
+ token_source: "callback"
661
+ });
662
+ return { user, session_token: token };
635
663
  }
636
664
  var init_device_code = __esm(() => {
637
- init_timings();
638
- init_facade2();
665
+ init_urls();
639
666
  init_facade3();
640
- init_facade4();
641
667
  init_facade();
642
668
  init_token_store();
669
+ init_callback_listener();
643
670
  init_errors2();
644
671
  });
645
672
 
@@ -683,7 +710,7 @@ async function logout() {
683
710
  return { revoked };
684
711
  }
685
712
  async function register(callbackPort) {
686
- const { openBrowser: openBrowser2 } = await Promise.resolve().then(() => (init_facade4(), exports_facade));
713
+ const { openBrowser: openBrowser2 } = await Promise.resolve().then(() => (init_facade3(), exports_facade));
687
714
  const url = `https://claudemesh.com/register?source=cli&callback=http://localhost:${callbackPort}`;
688
715
  await openBrowser2(url);
689
716
  }
@@ -731,66 +758,6 @@ var init_dashboard_sync = __esm(() => {
731
758
  init_urls();
732
759
  });
733
760
 
734
- // src/services/auth/callback-listener.ts
735
- import { createServer } from "node:http";
736
- function startCallbackListener() {
737
- return new Promise((resolveStart) => {
738
- let resolveToken;
739
- let resolved = false;
740
- const tokenPromise = new Promise((r) => {
741
- resolveToken = r;
742
- });
743
- const server = createServer((req, res) => {
744
- const url = new URL(req.url, "http://localhost");
745
- if (req.method === "OPTIONS") {
746
- res.writeHead(204, {
747
- "Access-Control-Allow-Origin": "https://claudemesh.com",
748
- "Access-Control-Allow-Methods": "GET",
749
- "Access-Control-Allow-Headers": "Content-Type"
750
- });
751
- res.end();
752
- return;
753
- }
754
- if (url.pathname === "/ping") {
755
- res.writeHead(200, {
756
- "Content-Type": "text/plain",
757
- "Access-Control-Allow-Origin": "https://claudemesh.com"
758
- });
759
- res.end("ok");
760
- return;
761
- }
762
- if (url.pathname === "/callback") {
763
- const token = url.searchParams.get("token");
764
- if (token && !resolved) {
765
- resolved = true;
766
- res.writeHead(200, {
767
- "Content-Type": "text/html",
768
- "Access-Control-Allow-Origin": "https://claudemesh.com"
769
- });
770
- res.end("<html><body><h2>Done! You can close this tab.</h2></body></html>");
771
- resolveToken(token);
772
- setTimeout(() => server.close(), 500);
773
- } else {
774
- res.writeHead(400, { "Content-Type": "text/plain" });
775
- res.end("Missing token");
776
- }
777
- return;
778
- }
779
- res.writeHead(404);
780
- res.end();
781
- });
782
- server.listen(0, "127.0.0.1", () => {
783
- const addr = server.address();
784
- resolveStart({
785
- port: addr.port,
786
- token: tokenPromise,
787
- close: () => server.close()
788
- });
789
- });
790
- });
791
- }
792
- var init_callback_listener = () => {};
793
-
794
761
  // src/services/auth/facade.ts
795
762
  var exports_facade3 = {};
796
763
  __export(exports_facade3, {
@@ -814,7 +781,7 @@ function generatePairingCode() {
814
781
  return Array.from(bytes, (b) => CHARS[b % CHARS.length]).join("");
815
782
  }
816
783
  var CHARS = "ABCDEFGHJKLMNPQRSTUVWXYZabcdefghjkmnpqrstuvwxyz23456789";
817
- var init_facade6 = __esm(() => {
784
+ var init_facade5 = __esm(() => {
818
785
  init_device_code();
819
786
  init_client2();
820
787
  init_dashboard_sync();
@@ -826,7 +793,7 @@ var init_facade6 = __esm(() => {
826
793
  // src/services/invite/generate.ts
827
794
  var init_generate = __esm(() => {
828
795
  init_facade2();
829
- init_facade6();
796
+ init_facade5();
830
797
  });
831
798
  // src/services/invite/errors.ts
832
799
  var init_errors3 = () => {};
@@ -985,7 +952,7 @@ async function verify(message, signatureHex, publicKeyHex) {
985
952
  return false;
986
953
  }
987
954
  }
988
- var init_facade7 = __esm(() => {
955
+ var init_facade6 = __esm(() => {
989
956
  init_keypair();
990
957
  init_file_crypto();
991
958
  init_box();
@@ -1083,7 +1050,7 @@ async function parseInviteLink2(link) {
1083
1050
  return { payload, raw: link, token: encoded };
1084
1051
  }
1085
1052
  var init_parse_v1 = __esm(() => {
1086
- init_facade7();
1053
+ init_facade6();
1087
1054
  });
1088
1055
 
1089
1056
  // src/services/invite/enroll.ts
@@ -1206,7 +1173,7 @@ function parseV2InviteInput(input) {
1206
1173
  var init_v2 = () => {};
1207
1174
 
1208
1175
  // src/services/invite/facade.ts
1209
- var init_facade8 = __esm(() => {
1176
+ var init_facade7 = __esm(() => {
1210
1177
  init_generate();
1211
1178
  init_errors3();
1212
1179
  init_parse_v1();
@@ -1221,7 +1188,7 @@ __export(exports_join, {
1221
1188
  import sodium3 from "libsodium-wrappers";
1222
1189
  import { writeFileSync as writeFileSync3, mkdirSync as mkdirSync2 } from "node:fs";
1223
1190
  import { join as join2, dirname } from "node:path";
1224
- import { homedir as homedir2, hostname as hostname2 } from "node:os";
1191
+ import { homedir as homedir2, hostname } from "node:os";
1225
1192
  function deriveAppBaseUrl() {
1226
1193
  const override = process.env.CLAUDEMESH_APP_URL;
1227
1194
  if (override)
@@ -1246,7 +1213,7 @@ async function runJoinV2(code) {
1246
1213
  process.exit(1);
1247
1214
  }
1248
1215
  const keypair = await generateKeypair3();
1249
- const displayName = `${hostname2()}-${process.pid}`;
1216
+ const displayName = `${hostname()}-${process.pid}`;
1250
1217
  await sodium3.ready;
1251
1218
  const rootKeyB64 = sodium3.to_base64(claim.rootKey, sodium3.base64_variants.URLSAFE_NO_PADDING);
1252
1219
  const fallbackSlug = `mesh-${claim.meshId.slice(0, 8)}`;
@@ -1300,7 +1267,7 @@ async function runJoin(args) {
1300
1267
  const { payload, token } = invite;
1301
1268
  console.log(`Joining mesh "${payload.mesh_slug}" (${payload.mesh_id})…`);
1302
1269
  const keypair = await generateKeypair3();
1303
- const displayName = `${hostname2()}-${process.pid}`;
1270
+ const displayName = `${hostname()}-${process.pid}`;
1304
1271
  let enroll;
1305
1272
  try {
1306
1273
  enroll = await enrollWithBroker2({
@@ -1343,11 +1310,11 @@ async function runJoin(args) {
1343
1310
  console.log("Restart Claude Code to pick up the new mesh.");
1344
1311
  }
1345
1312
  var init_join = __esm(() => {
1346
- init_facade8();
1347
- init_facade8();
1348
1313
  init_facade7();
1349
- init_facade5();
1350
- init_facade8();
1314
+ init_facade7();
1315
+ init_facade6();
1316
+ init_facade4();
1317
+ init_facade7();
1351
1318
  init_urls();
1352
1319
  });
1353
1320
 
@@ -1402,7 +1369,7 @@ async function login() {
1402
1369
  }
1403
1370
  }
1404
1371
  var init_login = __esm(() => {
1405
- init_facade6();
1372
+ init_facade5();
1406
1373
  init_facade2();
1407
1374
  init_styles();
1408
1375
  init_exit_codes();
@@ -1414,38 +1381,10 @@ __export(exports_register, {
1414
1381
  register: () => register2
1415
1382
  });
1416
1383
  async function register2() {
1417
- try {
1418
- console.log(`
1419
- Opening browser for account signup…`);
1420
- console.log(` Create your account, then approve the CLI sign-in.
1421
- `);
1422
- try {
1423
- await openBrowser("https://claudemesh.com/auth/register");
1424
- } catch {
1425
- console.log(` Visit: https://claudemesh.com/auth/register
1426
- `);
1427
- }
1428
- const result = await loginWithDeviceCode();
1429
- console.log(` ${green(icons.check)} Signed in as ${result.user.display_name}.`);
1430
- try {
1431
- const meshes = await exports_my.getMeshes(result.session_token);
1432
- if (meshes.length > 0) {
1433
- const names = meshes.map((m) => m.slug).join(", ");
1434
- console.log(` ${green(icons.check)} Synced ${meshes.length} mesh${meshes.length === 1 ? "" : "es"}: ${names}`);
1435
- }
1436
- } catch {}
1437
- return EXIT.SUCCESS;
1438
- } catch (err) {
1439
- console.error(` ${icons.cross} Registration failed: ${err instanceof Error ? err.message : err}`);
1440
- return EXIT.AUTH_FAILED;
1441
- }
1384
+ return login();
1442
1385
  }
1443
1386
  var init_register = __esm(() => {
1444
- init_facade6();
1445
- init_facade2();
1446
- init_facade4();
1447
- init_styles();
1448
- init_exit_codes();
1387
+ init_login();
1449
1388
  });
1450
1389
 
1451
1390
  // src/commands/welcome.ts
@@ -1480,7 +1419,7 @@ async function runWelcome() {
1480
1419
  });
1481
1420
  }
1482
1421
  var init_welcome2 = __esm(() => {
1483
- init_facade5();
1422
+ init_facade4();
1484
1423
  init_welcome();
1485
1424
  init_login();
1486
1425
  init_register();
@@ -1496,7 +1435,7 @@ async function signHello(meshId, memberId, pubkey, secretKeyHex) {
1496
1435
  return { timestamp: timestamp2, signature: s.to_hex(sig) };
1497
1436
  }
1498
1437
  var init_hello_sig = __esm(() => {
1499
- init_facade7();
1438
+ init_facade6();
1500
1439
  });
1501
1440
 
1502
1441
  // src/services/broker/ws-client.ts
@@ -3447,9 +3386,9 @@ function randomNonce() {
3447
3386
  }
3448
3387
  var MAX_QUEUED = 100, HELLO_ACK_TIMEOUT_MS = 5000, BACKOFF_CAPS;
3449
3388
  var init_ws_client = __esm(() => {
3450
- init_facade7();
3389
+ init_facade6();
3451
3390
  init_hello_sig();
3452
- init_facade7();
3391
+ init_facade6();
3453
3392
  BACKOFF_CAPS = [1000, 2000, 4000, 8000, 16000, 30000];
3454
3393
  });
3455
3394
 
@@ -3506,14 +3445,14 @@ var init_manager = __esm(() => {
3506
3445
 
3507
3446
  // src/services/broker/envelope.ts
3508
3447
  var init_envelope = __esm(() => {
3509
- init_facade7();
3448
+ init_facade6();
3510
3449
  });
3511
3450
 
3512
3451
  // src/services/broker/errors.ts
3513
3452
  var init_errors4 = () => {};
3514
3453
 
3515
3454
  // src/services/broker/facade.ts
3516
- var init_facade9 = __esm(() => {
3455
+ var init_facade8 = __esm(() => {
3517
3456
  init_ws_client();
3518
3457
  init_manager();
3519
3458
  init_hello_sig();
@@ -3695,7 +3634,7 @@ __export(exports_launch, {
3695
3634
  import { spawnSync as spawnSync2 } from "node:child_process";
3696
3635
  import { randomUUID } from "node:crypto";
3697
3636
  import { mkdtempSync, writeFileSync as writeFileSync4, rmSync, readdirSync, statSync, existsSync as existsSync4, readFileSync as readFileSync3 } from "node:fs";
3698
- import { tmpdir, hostname as hostname3, homedir as homedir3 } from "node:os";
3637
+ import { tmpdir, hostname as hostname2, homedir as homedir3 } from "node:os";
3699
3638
  import { join as join3 } from "node:path";
3700
3639
  import { createInterface as createInterface3 } from "node:readline";
3701
3640
  async function pickMesh(meshes) {
@@ -3903,7 +3842,7 @@ async function runLaunch(flags, rawArgs) {
3903
3842
  console.log("Joining mesh...");
3904
3843
  const invite = await parseInviteLink(args.joinLink);
3905
3844
  const keypair = await generateKeypair();
3906
- const displayName2 = args.name ?? `${hostname3()}-${process.pid}`;
3845
+ const displayName2 = args.name ?? `${hostname2()}-${process.pid}`;
3907
3846
  const enroll = await enrollWithBroker({
3908
3847
  brokerWsUrl: invite.payload.broker_url,
3909
3848
  inviteToken: invite.token,
@@ -3923,7 +3862,7 @@ async function runLaunch(flags, rawArgs) {
3923
3862
  brokerUrl: invite.payload.broker_url,
3924
3863
  joinedAt: new Date().toISOString()
3925
3864
  });
3926
- const { writeConfig: writeConfig2 } = await Promise.resolve().then(() => (init_facade5(), exports_facade2));
3865
+ const { writeConfig: writeConfig2 } = await Promise.resolve().then(() => (init_facade4(), exports_facade2));
3927
3866
  writeConfig2(config2);
3928
3867
  console.log(`✓ Joined "${invite.payload.mesh_slug}"${enroll.alreadyMember ? " (already member)" : ""}`);
3929
3868
  }
@@ -3970,12 +3909,12 @@ async function runLaunch(flags, rawArgs) {
3970
3909
  Timed out waiting for sign-in.`);
3971
3910
  process.exit(1);
3972
3911
  }
3973
- const { generateKeypair: generateKeypair4 } = await Promise.resolve().then(() => (init_facade7(), exports_facade4));
3912
+ const { generateKeypair: generateKeypair4 } = await Promise.resolve().then(() => (init_facade6(), exports_facade4));
3974
3913
  const keypair = await generateKeypair4();
3975
- const displayNameForSync = args.name ?? `${hostname3()}-${process.pid}`;
3976
- const { syncWithBroker: syncWithBroker2 } = await Promise.resolve().then(() => (init_facade6(), exports_facade3));
3914
+ const displayNameForSync = args.name ?? `${hostname2()}-${process.pid}`;
3915
+ const { syncWithBroker: syncWithBroker2 } = await Promise.resolve().then(() => (init_facade5(), exports_facade3));
3977
3916
  const result2 = await syncWithBroker2(syncToken, keypair.publicKey, displayNameForSync);
3978
- const { writeConfig: writeConfig2 } = await Promise.resolve().then(() => (init_facade5(), exports_facade2));
3917
+ const { writeConfig: writeConfig2 } = await Promise.resolve().then(() => (init_facade4(), exports_facade2));
3979
3918
  for (const m of result2.meshes) {
3980
3919
  config.meshes.push({
3981
3920
  meshId: m.mesh_id,
@@ -4012,7 +3951,7 @@ async function runLaunch(flags, rawArgs) {
4012
3951
  } else {
4013
3952
  mesh = null;
4014
3953
  }
4015
- const displayName = args.name ?? `${hostname3()}-${process.pid}`;
3954
+ const displayName = args.name ?? `${hostname2()}-${process.pid}`;
4016
3955
  let role = args.role;
4017
3956
  let parsedGroups = args.groups ? parseGroupsString(args.groups) : [];
4018
3957
  let messageMode = args.messageMode ?? "push";
@@ -4238,10 +4177,10 @@ async function runLaunch(flags, rawArgs) {
4238
4177
  process.exit(result.status ?? 0);
4239
4178
  }
4240
4179
  var init_launch = __esm(() => {
4241
- init_facade5();
4242
- init_facade6();
4243
4180
  init_facade4();
4244
- init_facade9();
4181
+ init_facade5();
4182
+ init_facade3();
4183
+ init_facade8();
4245
4184
  init_styles();
4246
4185
  init_screen();
4247
4186
  init_spinner();
@@ -7292,8 +7231,8 @@ async function startServiceProxy(serviceName) {
7292
7231
  var peerNameCache, peerNameCacheAge = 0, CACHE_TTL_MS = 30000;
7293
7232
  var init_server = __esm(() => {
7294
7233
  init_definitions();
7295
- init_facade5();
7296
- init_facade9();
7234
+ init_facade4();
7235
+ init_facade8();
7297
7236
  peerNameCache = new Map;
7298
7237
  });
7299
7238
 
@@ -7334,7 +7273,7 @@ async function logout2() {
7334
7273
  }
7335
7274
  }
7336
7275
  var init_logout = __esm(() => {
7337
- init_facade6();
7276
+ init_facade5();
7338
7277
  init_styles();
7339
7278
  init_exit_codes();
7340
7279
  });
@@ -7364,14 +7303,14 @@ async function whoami(opts) {
7364
7303
  return EXIT.SUCCESS;
7365
7304
  }
7366
7305
  var init_whoami = __esm(() => {
7367
- init_facade6();
7306
+ init_facade5();
7368
7307
  init_styles();
7369
7308
  init_exit_codes();
7370
7309
  });
7371
7310
 
7372
7311
  // src/services/mesh/list.ts
7373
7312
  var init_list = __esm(() => {
7374
- init_facade5();
7313
+ init_facade4();
7375
7314
  });
7376
7315
 
7377
7316
  // src/services/mesh/create.ts
@@ -7396,9 +7335,9 @@ async function createMesh2(name, opts) {
7396
7335
  }
7397
7336
  var init_create = __esm(() => {
7398
7337
  init_facade2();
7399
- init_facade6();
7400
- init_facade7();
7401
7338
  init_facade5();
7339
+ init_facade6();
7340
+ init_facade4();
7402
7341
  init_urls();
7403
7342
  });
7404
7343
 
@@ -7411,44 +7350,44 @@ async function renameMesh2(slug, newName) {
7411
7350
  }
7412
7351
  var init_rename = __esm(() => {
7413
7352
  init_facade2();
7414
- init_facade6();
7353
+ init_facade5();
7415
7354
  });
7416
7355
 
7417
7356
  // src/services/mesh/leave.ts
7418
7357
  var init_leave = __esm(() => {
7419
- init_facade5();
7358
+ init_facade4();
7420
7359
  });
7421
7360
 
7422
7361
  // src/services/mesh/join.ts
7423
7362
  var init_join2 = __esm(() => {
7424
7363
  init_facade2();
7425
- init_facade7();
7426
- init_facade5();
7364
+ init_facade6();
7365
+ init_facade4();
7427
7366
  init_urls();
7428
7367
  });
7429
7368
 
7430
7369
  // src/services/state/last-used.ts
7431
7370
  var init_last_used = __esm(() => {
7432
7371
  init_paths();
7433
- init_facade5();
7372
+ init_facade4();
7434
7373
  });
7435
7374
 
7436
7375
  // src/services/state/facade.ts
7437
- var init_facade10 = __esm(() => {
7376
+ var init_facade9 = __esm(() => {
7438
7377
  init_last_used();
7439
7378
  });
7440
7379
 
7441
7380
  // src/services/mesh/resolve-target.ts
7442
7381
  var init_resolve_target = __esm(() => {
7443
- init_facade5();
7444
- init_facade10();
7382
+ init_facade4();
7383
+ init_facade9();
7445
7384
  });
7446
7385
 
7447
7386
  // src/services/mesh/errors.ts
7448
7387
  var init_errors5 = () => {};
7449
7388
 
7450
7389
  // src/services/mesh/facade.ts
7451
- var init_facade11 = __esm(() => {
7390
+ var init_facade10 = __esm(() => {
7452
7391
  init_list();
7453
7392
  init_create();
7454
7393
  init_rename();
@@ -7492,17 +7431,17 @@ async function newMesh(name, opts) {
7492
7431
  }
7493
7432
  }
7494
7433
  var init_new = __esm(() => {
7495
- init_facade11();
7434
+ init_facade10();
7496
7435
  init_styles();
7497
7436
  init_exit_codes();
7498
7437
  });
7499
7438
 
7500
7439
  // src/services/clipboard/read.ts
7501
7440
  import { execSync } from "node:child_process";
7502
- import { platform as platform4 } from "node:os";
7441
+ import { platform as platform3 } from "node:os";
7503
7442
  function writeClipboard(text2) {
7504
7443
  try {
7505
- const os = platform4();
7444
+ const os = platform3();
7506
7445
  if (os === "darwin") {
7507
7446
  execSync("pbcopy", { input: text2 });
7508
7447
  return true;
@@ -7527,7 +7466,7 @@ function writeClipboard(text2) {
7527
7466
  var init_read2 = () => {};
7528
7467
 
7529
7468
  // src/services/clipboard/facade.ts
7530
- var init_facade12 = __esm(() => {
7469
+ var init_facade11 = __esm(() => {
7531
7470
  init_read2();
7532
7471
  });
7533
7472
 
@@ -7580,10 +7519,10 @@ async function invite(email, opts = {}) {
7580
7519
  }
7581
7520
  }
7582
7521
  var init_invite = __esm(() => {
7583
- init_facade6();
7584
- init_facade2();
7585
7522
  init_facade5();
7586
- init_facade12();
7523
+ init_facade2();
7524
+ init_facade4();
7525
+ init_facade11();
7587
7526
  init_styles();
7588
7527
  init_exit_codes();
7589
7528
  });
@@ -7616,7 +7555,7 @@ function runList() {
7616
7555
  console.log(`Config: ${getConfigPath()}`);
7617
7556
  }
7618
7557
  var init_list2 = __esm(() => {
7619
- init_facade5();
7558
+ init_facade4();
7620
7559
  });
7621
7560
 
7622
7561
  // src/commands/leave.ts
@@ -7641,7 +7580,7 @@ function runLeave(args) {
7641
7580
  console.log(`Left mesh "${slug}". Remaining: ${config.meshes.length}`);
7642
7581
  }
7643
7582
  var init_leave2 = __esm(() => {
7644
- init_facade5();
7583
+ init_facade4();
7645
7584
  });
7646
7585
 
7647
7586
  // src/commands/rename.ts
@@ -7660,13 +7599,13 @@ async function rename(slug, newName) {
7660
7599
  }
7661
7600
  }
7662
7601
  var init_rename2 = __esm(() => {
7663
- init_facade11();
7602
+ init_facade10();
7664
7603
  init_styles();
7665
7604
  init_exit_codes();
7666
7605
  });
7667
7606
 
7668
7607
  // src/commands/connect.ts
7669
- import { hostname as hostname4 } from "node:os";
7608
+ import { hostname as hostname3 } from "node:os";
7670
7609
  import { createInterface as createInterface4 } from "node:readline";
7671
7610
  async function pickMesh2(meshes) {
7672
7611
  console.log(`
@@ -7708,7 +7647,7 @@ async function withMesh(opts, fn) {
7708
7647
  } else {
7709
7648
  mesh = await pickMesh2(config.meshes);
7710
7649
  }
7711
- const displayName = opts.displayName ?? config.displayName ?? `${hostname4()}-${process.pid}`;
7650
+ const displayName = opts.displayName ?? config.displayName ?? `${hostname3()}-${process.pid}`;
7712
7651
  const client = new BrokerClient(mesh, { displayName });
7713
7652
  try {
7714
7653
  await client.connect();
@@ -7719,8 +7658,8 @@ async function withMesh(opts, fn) {
7719
7658
  }
7720
7659
  }
7721
7660
  var init_connect = __esm(() => {
7722
- init_facade9();
7723
- init_facade5();
7661
+ init_facade8();
7662
+ init_facade4();
7724
7663
  });
7725
7664
 
7726
7665
  // src/commands/peers.ts
@@ -7786,7 +7725,7 @@ async function runPeers(flags) {
7786
7725
  }
7787
7726
  var init_peers = __esm(() => {
7788
7727
  init_connect();
7789
- init_facade5();
7728
+ init_facade4();
7790
7729
  });
7791
7730
 
7792
7731
  // src/commands/send.ts
@@ -7970,9 +7909,9 @@ async function runInfo(flags) {
7970
7909
  }
7971
7910
  });
7972
7911
  }
7973
- var init_info2 = __esm(() => {
7912
+ var init_info = __esm(() => {
7974
7913
  init_connect();
7975
- init_facade5();
7914
+ init_facade4();
7976
7915
  });
7977
7916
 
7978
7917
  // src/commands/remember.ts
@@ -8000,7 +7939,7 @@ async function remember(content, opts = {}) {
8000
7939
  return EXIT.INTERNAL_ERROR;
8001
7940
  }
8002
7941
  var init_remember = __esm(() => {
8003
- init_facade9();
7942
+ init_facade8();
8004
7943
  init_exit_codes();
8005
7944
  });
8006
7945
 
@@ -8034,7 +7973,7 @@ async function recall(query, opts = {}) {
8034
7973
  return EXIT.SUCCESS;
8035
7974
  }
8036
7975
  var init_recall = __esm(() => {
8037
- init_facade9();
7976
+ init_facade8();
8038
7977
  init_styles();
8039
7978
  init_exit_codes();
8040
7979
  });
@@ -8261,7 +8200,7 @@ function printProfile(member, dim2) {
8261
8200
  console.log(` Mesh: ${dim2(String(member.id ?? ""))}`);
8262
8201
  }
8263
8202
  var init_profile = __esm(() => {
8264
- init_facade5();
8203
+ init_facade4();
8265
8204
  });
8266
8205
 
8267
8206
  // src/commands/status.ts
@@ -8349,7 +8288,7 @@ async function runStatus() {
8349
8288
  }
8350
8289
  }
8351
8290
  var init_status = __esm(() => {
8352
- init_facade5();
8291
+ init_facade4();
8353
8292
  init_urls();
8354
8293
  });
8355
8294
 
@@ -8359,7 +8298,7 @@ __export(exports_doctor, {
8359
8298
  runDoctor: () => runDoctor
8360
8299
  });
8361
8300
  import { existsSync as existsSync6, readFileSync as readFileSync4, statSync as statSync3 } from "node:fs";
8362
- import { homedir as homedir4, platform as platform5 } from "node:os";
8301
+ import { homedir as homedir4, platform as platform4 } from "node:os";
8363
8302
  import { join as join4 } from "node:path";
8364
8303
  import { spawnSync as spawnSync3 } from "node:child_process";
8365
8304
  function checkNode() {
@@ -8372,7 +8311,7 @@ function checkNode() {
8372
8311
  };
8373
8312
  }
8374
8313
  function checkClaudeOnPath() {
8375
- const res = platform5() === "win32" ? spawnSync3("where", ["claude"]) : spawnSync3("sh", ["-c", "command -v claude"]);
8314
+ const res = platform4() === "win32" ? spawnSync3("where", ["claude"]) : spawnSync3("sh", ["-c", "command -v claude"]);
8376
8315
  const onPath = res.status === 0;
8377
8316
  const location = onPath ? res.stdout.toString().trim().split(`
8378
8317
  `)[0] : undefined;
@@ -8447,11 +8386,11 @@ function checkConfigFile() {
8447
8386
  readConfig();
8448
8387
  const st = statSync3(path);
8449
8388
  const mode = (st.mode & 511).toString(8);
8450
- const secure = platform5() === "win32" || mode === "600";
8389
+ const secure = platform4() === "win32" || mode === "600";
8451
8390
  return {
8452
8391
  name: "~/.claudemesh/config.json parses + chmod 0600",
8453
8392
  pass: secure,
8454
- detail: platform5() === "win32" ? "chmod skipped on Windows" : `0${mode}`,
8393
+ detail: platform4() === "win32" ? "chmod skipped on Windows" : `0${mode}`,
8455
8394
  fix: secure ? undefined : `chmod 600 ${path}`
8456
8395
  };
8457
8396
  } catch (e) {
@@ -8538,7 +8477,7 @@ async function runDoctor() {
8538
8477
  }
8539
8478
  }
8540
8479
  var init_doctor = __esm(() => {
8541
- init_facade5();
8480
+ init_facade4();
8542
8481
  init_urls();
8543
8482
  });
8544
8483
 
@@ -8556,7 +8495,7 @@ import {
8556
8495
  readFileSync as readFileSync5,
8557
8496
  writeFileSync as writeFileSync5
8558
8497
  } from "node:fs";
8559
- import { homedir as homedir5, platform as platform6 } from "node:os";
8498
+ import { homedir as homedir5, platform as platform5 } from "node:os";
8560
8499
  import { dirname as dirname2, join as join5, resolve } from "node:path";
8561
8500
  import { fileURLToPath } from "node:url";
8562
8501
  import { spawnSync as spawnSync4 } from "node:child_process";
@@ -8623,7 +8562,7 @@ function flushClaudeConfig(obj) {
8623
8562
  } catch {}
8624
8563
  }
8625
8564
  function bunAvailable() {
8626
- const res = platform6() === "win32" ? spawnSync4("where", ["bun"]) : spawnSync4("sh", ["-c", "command -v bun"]);
8565
+ const res = platform5() === "win32" ? spawnSync4("where", ["bun"]) : spawnSync4("sh", ["-c", "command -v bun"]);
8627
8566
  return res.status === 0;
8628
8567
  }
8629
8568
  function resolveEntry() {
@@ -8849,7 +8788,7 @@ function runUninstall() {
8849
8788
  }
8850
8789
  var MCP_NAME = "claudemesh", CLAUDE_CONFIG, CLAUDE_SETTINGS, HOOK_COMMAND_STOP = "claudemesh hook idle", HOOK_COMMAND_USER_PROMPT = "claudemesh hook working", HOOK_MARKER = "claudemesh hook ", CLAUDEMESH_TOOLS;
8851
8790
  var init_install = __esm(() => {
8852
- init_facade5();
8791
+ init_facade4();
8853
8792
  CLAUDE_CONFIG = join5(homedir5(), ".claude.json");
8854
8793
  CLAUDE_SETTINGS = join5(homedir5(), ".claude", "settings.json");
8855
8794
  CLAUDEMESH_TOOLS = [
@@ -8971,7 +8910,7 @@ __export(exports_sync, {
8971
8910
  runSync: () => runSync
8972
8911
  });
8973
8912
  import { createInterface as createInterface5 } from "node:readline";
8974
- import { hostname as hostname5 } from "node:os";
8913
+ import { hostname as hostname4 } from "node:os";
8975
8914
  async function runSync(args) {
8976
8915
  const useColor = !process.env.NO_COLOR && process.env.TERM !== "dumb" && process.stdout.isTTY;
8977
8916
  const dim2 = (s) => useColor ? `\x1B[2m${s}\x1B[22m` : s;
@@ -9005,7 +8944,7 @@ async function runSync(args) {
9005
8944
  process.exit(1);
9006
8945
  }
9007
8946
  const keypair = config.meshes.length > 0 ? { publicKey: config.meshes[0].pubkey, secretKey: config.meshes[0].secretKey } : await generateKeypair3();
9008
- const displayName = config.displayName ?? `${hostname5()}-${process.pid}`;
8947
+ const displayName = config.displayName ?? `${hostname4()}-${process.pid}`;
9009
8948
  const result = await syncWithBroker(syncToken, keypair.publicKey, displayName);
9010
8949
  let added = 0;
9011
8950
  for (const m of result.meshes) {
@@ -9032,10 +8971,10 @@ async function runSync(args) {
9032
8971
  }
9033
8972
  }
9034
8973
  var init_sync = __esm(() => {
8974
+ init_facade4();
9035
8975
  init_facade5();
8976
+ init_facade3();
9036
8977
  init_facade6();
9037
- init_facade4();
9038
- init_facade7();
9039
8978
  });
9040
8979
 
9041
8980
  // src/commands/hook.ts
@@ -9118,7 +9057,7 @@ async function runHook(args) {
9118
9057
  }
9119
9058
  var DEBUG;
9120
9059
  var init_hook = __esm(() => {
9121
- init_facade5();
9060
+ init_facade4();
9122
9061
  DEBUG = process.env.CLAUDEMESH_HOOK_DEBUG === "1";
9123
9062
  });
9124
9063
 
@@ -9152,7 +9091,7 @@ function runSeedTestMesh(args) {
9152
9091
  console.log(`Run \`claudemesh mcp\` to connect, or register with Claude Code via \`claudemesh install\`.`);
9153
9092
  }
9154
9093
  var init_seed_test_mesh = __esm(() => {
9155
- init_facade5();
9094
+ init_facade4();
9156
9095
  });
9157
9096
 
9158
9097
  // ../../node_modules/qrcode-terminal/vendor/QRCode/QRMode.js
@@ -10226,7 +10165,7 @@ async function connectTelegram(args) {
10226
10165
  }
10227
10166
  }
10228
10167
  var init_connect_telegram = __esm(() => {
10229
- init_facade5();
10168
+ init_facade4();
10230
10169
  });
10231
10170
 
10232
10171
  // src/cli/argv.ts
@@ -10428,7 +10367,7 @@ async function main() {
10428
10367
  await runJoin2([command]);
10429
10368
  return;
10430
10369
  }
10431
- const { readConfig: readConfig2 } = await Promise.resolve().then(() => (init_facade5(), exports_facade2));
10370
+ const { readConfig: readConfig2 } = await Promise.resolve().then(() => (init_facade4(), exports_facade2));
10432
10371
  const config = readConfig2();
10433
10372
  if (config.meshes.length === 0) {
10434
10373
  const { runWelcome: runWelcome2 } = await Promise.resolve().then(() => (init_welcome2(), exports_welcome));
@@ -10533,7 +10472,7 @@ async function main() {
10533
10472
  break;
10534
10473
  }
10535
10474
  case "info": {
10536
- const { runInfo: runInfo2 } = await Promise.resolve().then(() => (init_info2(), exports_info));
10475
+ const { runInfo: runInfo2 } = await Promise.resolve().then(() => (init_info(), exports_info));
10537
10476
  await runInfo2({});
10538
10477
  break;
10539
10478
  }
@@ -10619,4 +10558,4 @@ main().catch((err) => {
10619
10558
  process.exit(EXIT.INTERNAL_ERROR);
10620
10559
  });
10621
10560
 
10622
- //# debugId=FA11CE2414855F8F64756E2164756E21
10561
+ //# debugId=CD07DBA798B645E164756E2164756E21