claudemesh-cli 1.0.0-alpha.5 → 1.0.0-alpha.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.
@@ -278,8 +278,34 @@ 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 request({
292
+ path: "/cli/device-code",
293
+ method: "POST",
294
+ body: deviceInfo,
295
+ baseUrl: BROKER_HTTP
296
+ });
297
+ }
298
+ async function pollDeviceCode(deviceCode) {
299
+ return request({
300
+ path: `/cli/device-code/${deviceCode}`,
301
+ baseUrl: BROKER_HTTP
302
+ });
303
+ }
304
+ var BROKER_HTTP;
281
305
  var init_public = __esm(() => {
282
306
  init_client();
307
+ init_urls();
308
+ BROKER_HTTP = URLS.BROKER.replace("wss://", "https://").replace("ws://", "http://").replace("/ws", "");
283
309
  });
284
310
 
285
311
  // src/services/api/facade.ts
@@ -290,6 +316,24 @@ var init_facade2 = __esm(() => {
290
316
  init_public();
291
317
  });
292
318
 
319
+ // src/services/device/info.ts
320
+ import { hostname, platform, arch, release } from "node:os";
321
+ function getDeviceInfo() {
322
+ return {
323
+ hostname: hostname(),
324
+ platform: platform(),
325
+ arch: arch(),
326
+ osRelease: release(),
327
+ nodeVersion: process.version
328
+ };
329
+ }
330
+ var init_info = () => {};
331
+
332
+ // src/services/device/facade.ts
333
+ var init_facade3 = __esm(() => {
334
+ init_info();
335
+ });
336
+
293
337
  // src/services/spawn/claude.ts
294
338
  import { spawnSync } from "node:child_process";
295
339
  import { existsSync } from "node:fs";
@@ -323,10 +367,10 @@ var init_claude = () => {};
323
367
 
324
368
  // src/services/spawn/browser.ts
325
369
  import { execFile } from "node:child_process";
326
- import { platform } from "node:os";
370
+ import { platform as platform2 } from "node:os";
327
371
  function openBrowser(url) {
328
372
  return new Promise((resolve, reject) => {
329
- const os = platform();
373
+ const os = platform2();
330
374
  let bin;
331
375
  let args;
332
376
  if (os === "darwin") {
@@ -356,7 +400,7 @@ __export(exports_facade, {
356
400
  openBrowser: () => openBrowser,
357
401
  findClaudeBinary: () => findClaudeBinary
358
402
  });
359
- var init_facade3 = __esm(() => {
403
+ var init_facade4 = __esm(() => {
360
404
  init_claude();
361
405
  init_browser();
362
406
  });
@@ -424,7 +468,7 @@ var init_read = __esm(() => {
424
468
 
425
469
  // src/services/config/write.ts
426
470
  import { writeFileSync, mkdirSync, chmodSync, openSync, closeSync, renameSync } from "node:fs";
427
- import { platform as platform2 } from "node:os";
471
+ import { platform as platform3 } from "node:os";
428
472
  function ensureConfigDir() {
429
473
  mkdirSync(PATHS.CONFIG_DIR, { recursive: true });
430
474
  if (!isWindows) {
@@ -477,7 +521,7 @@ var isWindows;
477
521
  var init_write = __esm(() => {
478
522
  init_paths();
479
523
  init_read();
480
- isWindows = platform2() === "win32";
524
+ isWindows = platform3() === "win32";
481
525
  });
482
526
 
483
527
  // src/services/config/facade.ts
@@ -495,7 +539,7 @@ __export(exports_facade2, {
495
539
  function getConfigPath() {
496
540
  return PATHS.CONFIG_FILE;
497
541
  }
498
- var init_facade4 = __esm(() => {
542
+ var init_facade5 = __esm(() => {
499
543
  init_read();
500
544
  init_write();
501
545
  init_paths();
@@ -532,69 +576,9 @@ function clearToken() {
532
576
  }
533
577
  var init_token_store = __esm(() => {
534
578
  init_paths();
535
- init_facade4();
579
+ init_facade5();
536
580
  });
537
581
 
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
-
598
582
  // src/services/auth/errors.ts
599
583
  var AuthError, DeviceCodeExpired, NotSignedIn;
600
584
  var init_errors2 = __esm(() => {
@@ -618,55 +602,67 @@ var init_errors2 = __esm(() => {
618
602
 
619
603
  // src/services/auth/device-code.ts
620
604
  async function loginWithDeviceCode() {
621
- const listener = await startCallbackListener();
622
- const authUrl = `${URLS.API_BASE}/cli-auth?port=${listener.port}`;
623
- log(`
624
- Opening browser for sign-in…
625
- `);
626
- log(` If your browser didn't open, visit:`);
627
- log(` ${authUrl}
628
- `);
629
- log(` Waiting for confirmation…
630
- `);
605
+ const device = getDeviceInfo();
606
+ const { device_code, user_code, verification_url } = await exports_public.requestDeviceCode({
607
+ hostname: device.hostname,
608
+ platform: device.platform,
609
+ arch: device.arch
610
+ });
611
+ const url = `${verification_url}?code=${user_code}`;
612
+ const isTTY2 = process.stdout.isTTY && !process.env.NO_COLOR;
613
+ const orange2 = (s) => isTTY2 ? `\x1B[38;5;208m${s}\x1B[0m` : s;
614
+ const bold2 = (s) => isTTY2 ? `\x1B[1m${s}\x1B[0m` : s;
615
+ const dim2 = (s) => isTTY2 ? `\x1B[2m${s}\x1B[0m` : s;
616
+ log("");
617
+ log(" " + orange2("claudemesh") + " — sign in to connect your terminal");
618
+ log("");
619
+ log(" ┌──────────────────────────────────┐");
620
+ log(" │ │");
621
+ log(" │ Your code: " + bold2(user_code) + " │");
622
+ log(" │ │");
623
+ log(" └──────────────────────────────────┘");
624
+ log("");
625
+ log(" " + dim2("Confirm this code matches your browser."));
626
+ log(" " + dim2("If your browser didn't open, visit:"));
627
+ log(" " + dim2(url));
628
+ log("");
629
+ log(" Waiting for confirmation… " + dim2("(Ctrl-C to cancel)"));
630
+ log("");
631
631
  try {
632
- await openBrowser(authUrl);
632
+ await openBrowser(`${verification_url}?code=${user_code}`);
633
633
  } catch {
634
634
  warn("Could not open browser automatically.");
635
635
  }
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();
644
- }
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
- };
636
+ const startTime = Date.now();
637
+ while (Date.now() - startTime < TIMINGS.DEVICE_CODE_TIMEOUT_MS) {
638
+ await new Promise((r) => setTimeout(r, TIMINGS.DEVICE_CODE_POLL_MS));
639
+ let poll;
640
+ try {
641
+ poll = await exports_public.pollDeviceCode(device_code);
642
+ } catch {
643
+ continue;
655
644
  }
656
- } catch {}
657
- storeToken({
658
- session_token: token,
659
- user,
660
- token_source: "callback"
661
- });
662
- return { user, session_token: token };
645
+ if (poll.status === "approved" && poll.session_token && poll.user) {
646
+ storeToken({
647
+ session_token: poll.session_token,
648
+ user: poll.user,
649
+ token_source: "device-code"
650
+ });
651
+ return { user: poll.user, session_token: poll.session_token };
652
+ }
653
+ if (poll.status === "expired") {
654
+ throw new DeviceCodeExpired;
655
+ }
656
+ }
657
+ throw new DeviceCodeExpired;
663
658
  }
664
659
  var init_device_code = __esm(() => {
665
- init_urls();
660
+ init_timings();
661
+ init_facade2();
666
662
  init_facade3();
663
+ init_facade4();
667
664
  init_facade();
668
665
  init_token_store();
669
- init_callback_listener();
670
666
  init_errors2();
671
667
  });
672
668
 
@@ -710,7 +706,7 @@ async function logout() {
710
706
  return { revoked };
711
707
  }
712
708
  async function register(callbackPort) {
713
- const { openBrowser: openBrowser2 } = await Promise.resolve().then(() => (init_facade3(), exports_facade));
709
+ const { openBrowser: openBrowser2 } = await Promise.resolve().then(() => (init_facade4(), exports_facade));
714
710
  const url = `https://claudemesh.com/register?source=cli&callback=http://localhost:${callbackPort}`;
715
711
  await openBrowser2(url);
716
712
  }
@@ -758,6 +754,66 @@ var init_dashboard_sync = __esm(() => {
758
754
  init_urls();
759
755
  });
760
756
 
757
+ // src/services/auth/callback-listener.ts
758
+ import { createServer } from "node:http";
759
+ function startCallbackListener() {
760
+ return new Promise((resolveStart) => {
761
+ let resolveToken;
762
+ let resolved = false;
763
+ const tokenPromise = new Promise((r) => {
764
+ resolveToken = r;
765
+ });
766
+ const server = createServer((req, res) => {
767
+ const url = new URL(req.url, "http://localhost");
768
+ if (req.method === "OPTIONS") {
769
+ res.writeHead(204, {
770
+ "Access-Control-Allow-Origin": "https://claudemesh.com",
771
+ "Access-Control-Allow-Methods": "GET",
772
+ "Access-Control-Allow-Headers": "Content-Type"
773
+ });
774
+ res.end();
775
+ return;
776
+ }
777
+ if (url.pathname === "/ping") {
778
+ res.writeHead(200, {
779
+ "Content-Type": "text/plain",
780
+ "Access-Control-Allow-Origin": "https://claudemesh.com"
781
+ });
782
+ res.end("ok");
783
+ return;
784
+ }
785
+ if (url.pathname === "/callback") {
786
+ const token = url.searchParams.get("token");
787
+ if (token && !resolved) {
788
+ resolved = true;
789
+ res.writeHead(200, {
790
+ "Content-Type": "text/html",
791
+ "Access-Control-Allow-Origin": "https://claudemesh.com"
792
+ });
793
+ res.end("<html><body><h2>Done! You can close this tab.</h2></body></html>");
794
+ resolveToken(token);
795
+ setTimeout(() => server.close(), 500);
796
+ } else {
797
+ res.writeHead(400, { "Content-Type": "text/plain" });
798
+ res.end("Missing token");
799
+ }
800
+ return;
801
+ }
802
+ res.writeHead(404);
803
+ res.end();
804
+ });
805
+ server.listen(0, "127.0.0.1", () => {
806
+ const addr = server.address();
807
+ resolveStart({
808
+ port: addr.port,
809
+ token: tokenPromise,
810
+ close: () => server.close()
811
+ });
812
+ });
813
+ });
814
+ }
815
+ var init_callback_listener = () => {};
816
+
761
817
  // src/services/auth/facade.ts
762
818
  var exports_facade3 = {};
763
819
  __export(exports_facade3, {
@@ -781,7 +837,7 @@ function generatePairingCode() {
781
837
  return Array.from(bytes, (b) => CHARS[b % CHARS.length]).join("");
782
838
  }
783
839
  var CHARS = "ABCDEFGHJKLMNPQRSTUVWXYZabcdefghjkmnpqrstuvwxyz23456789";
784
- var init_facade5 = __esm(() => {
840
+ var init_facade6 = __esm(() => {
785
841
  init_device_code();
786
842
  init_client2();
787
843
  init_dashboard_sync();
@@ -793,7 +849,7 @@ var init_facade5 = __esm(() => {
793
849
  // src/services/invite/generate.ts
794
850
  var init_generate = __esm(() => {
795
851
  init_facade2();
796
- init_facade5();
852
+ init_facade6();
797
853
  });
798
854
  // src/services/invite/errors.ts
799
855
  var init_errors3 = () => {};
@@ -952,7 +1008,7 @@ async function verify(message, signatureHex, publicKeyHex) {
952
1008
  return false;
953
1009
  }
954
1010
  }
955
- var init_facade6 = __esm(() => {
1011
+ var init_facade7 = __esm(() => {
956
1012
  init_keypair();
957
1013
  init_file_crypto();
958
1014
  init_box();
@@ -1050,7 +1106,7 @@ async function parseInviteLink2(link) {
1050
1106
  return { payload, raw: link, token: encoded };
1051
1107
  }
1052
1108
  var init_parse_v1 = __esm(() => {
1053
- init_facade6();
1109
+ init_facade7();
1054
1110
  });
1055
1111
 
1056
1112
  // src/services/invite/enroll.ts
@@ -1173,7 +1229,7 @@ function parseV2InviteInput(input) {
1173
1229
  var init_v2 = () => {};
1174
1230
 
1175
1231
  // src/services/invite/facade.ts
1176
- var init_facade7 = __esm(() => {
1232
+ var init_facade8 = __esm(() => {
1177
1233
  init_generate();
1178
1234
  init_errors3();
1179
1235
  init_parse_v1();
@@ -1188,7 +1244,7 @@ __export(exports_join, {
1188
1244
  import sodium3 from "libsodium-wrappers";
1189
1245
  import { writeFileSync as writeFileSync3, mkdirSync as mkdirSync2 } from "node:fs";
1190
1246
  import { join as join2, dirname } from "node:path";
1191
- import { homedir as homedir2, hostname } from "node:os";
1247
+ import { homedir as homedir2, hostname as hostname2 } from "node:os";
1192
1248
  function deriveAppBaseUrl() {
1193
1249
  const override = process.env.CLAUDEMESH_APP_URL;
1194
1250
  if (override)
@@ -1213,7 +1269,7 @@ async function runJoinV2(code) {
1213
1269
  process.exit(1);
1214
1270
  }
1215
1271
  const keypair = await generateKeypair3();
1216
- const displayName = `${hostname()}-${process.pid}`;
1272
+ const displayName = `${hostname2()}-${process.pid}`;
1217
1273
  await sodium3.ready;
1218
1274
  const rootKeyB64 = sodium3.to_base64(claim.rootKey, sodium3.base64_variants.URLSAFE_NO_PADDING);
1219
1275
  const fallbackSlug = `mesh-${claim.meshId.slice(0, 8)}`;
@@ -1267,7 +1323,7 @@ async function runJoin(args) {
1267
1323
  const { payload, token } = invite;
1268
1324
  console.log(`Joining mesh "${payload.mesh_slug}" (${payload.mesh_id})…`);
1269
1325
  const keypair = await generateKeypair3();
1270
- const displayName = `${hostname()}-${process.pid}`;
1326
+ const displayName = `${hostname2()}-${process.pid}`;
1271
1327
  let enroll;
1272
1328
  try {
1273
1329
  enroll = await enrollWithBroker2({
@@ -1310,11 +1366,11 @@ async function runJoin(args) {
1310
1366
  console.log("Restart Claude Code to pick up the new mesh.");
1311
1367
  }
1312
1368
  var init_join = __esm(() => {
1369
+ init_facade8();
1370
+ init_facade8();
1313
1371
  init_facade7();
1314
- init_facade7();
1315
- init_facade6();
1316
- init_facade4();
1317
- init_facade7();
1372
+ init_facade5();
1373
+ init_facade8();
1318
1374
  init_urls();
1319
1375
  });
1320
1376
 
@@ -1369,7 +1425,7 @@ async function login() {
1369
1425
  }
1370
1426
  }
1371
1427
  var init_login = __esm(() => {
1372
- init_facade5();
1428
+ init_facade6();
1373
1429
  init_facade2();
1374
1430
  init_styles();
1375
1431
  init_exit_codes();
@@ -1419,7 +1475,7 @@ async function runWelcome() {
1419
1475
  });
1420
1476
  }
1421
1477
  var init_welcome2 = __esm(() => {
1422
- init_facade4();
1478
+ init_facade5();
1423
1479
  init_welcome();
1424
1480
  init_login();
1425
1481
  init_register();
@@ -1435,7 +1491,7 @@ async function signHello(meshId, memberId, pubkey, secretKeyHex) {
1435
1491
  return { timestamp: timestamp2, signature: s.to_hex(sig) };
1436
1492
  }
1437
1493
  var init_hello_sig = __esm(() => {
1438
- init_facade6();
1494
+ init_facade7();
1439
1495
  });
1440
1496
 
1441
1497
  // src/services/broker/ws-client.ts
@@ -3386,9 +3442,9 @@ function randomNonce() {
3386
3442
  }
3387
3443
  var MAX_QUEUED = 100, HELLO_ACK_TIMEOUT_MS = 5000, BACKOFF_CAPS;
3388
3444
  var init_ws_client = __esm(() => {
3389
- init_facade6();
3445
+ init_facade7();
3390
3446
  init_hello_sig();
3391
- init_facade6();
3447
+ init_facade7();
3392
3448
  BACKOFF_CAPS = [1000, 2000, 4000, 8000, 16000, 30000];
3393
3449
  });
3394
3450
 
@@ -3445,14 +3501,14 @@ var init_manager = __esm(() => {
3445
3501
 
3446
3502
  // src/services/broker/envelope.ts
3447
3503
  var init_envelope = __esm(() => {
3448
- init_facade6();
3504
+ init_facade7();
3449
3505
  });
3450
3506
 
3451
3507
  // src/services/broker/errors.ts
3452
3508
  var init_errors4 = () => {};
3453
3509
 
3454
3510
  // src/services/broker/facade.ts
3455
- var init_facade8 = __esm(() => {
3511
+ var init_facade9 = __esm(() => {
3456
3512
  init_ws_client();
3457
3513
  init_manager();
3458
3514
  init_hello_sig();
@@ -3634,7 +3690,7 @@ __export(exports_launch, {
3634
3690
  import { spawnSync as spawnSync2 } from "node:child_process";
3635
3691
  import { randomUUID } from "node:crypto";
3636
3692
  import { mkdtempSync, writeFileSync as writeFileSync4, rmSync, readdirSync, statSync, existsSync as existsSync4, readFileSync as readFileSync3 } from "node:fs";
3637
- import { tmpdir, hostname as hostname2, homedir as homedir3 } from "node:os";
3693
+ import { tmpdir, hostname as hostname3, homedir as homedir3 } from "node:os";
3638
3694
  import { join as join3 } from "node:path";
3639
3695
  import { createInterface as createInterface3 } from "node:readline";
3640
3696
  async function pickMesh(meshes) {
@@ -3842,7 +3898,7 @@ async function runLaunch(flags, rawArgs) {
3842
3898
  console.log("Joining mesh...");
3843
3899
  const invite = await parseInviteLink(args.joinLink);
3844
3900
  const keypair = await generateKeypair();
3845
- const displayName2 = args.name ?? `${hostname2()}-${process.pid}`;
3901
+ const displayName2 = args.name ?? `${hostname3()}-${process.pid}`;
3846
3902
  const enroll = await enrollWithBroker({
3847
3903
  brokerWsUrl: invite.payload.broker_url,
3848
3904
  inviteToken: invite.token,
@@ -3862,7 +3918,7 @@ async function runLaunch(flags, rawArgs) {
3862
3918
  brokerUrl: invite.payload.broker_url,
3863
3919
  joinedAt: new Date().toISOString()
3864
3920
  });
3865
- const { writeConfig: writeConfig2 } = await Promise.resolve().then(() => (init_facade4(), exports_facade2));
3921
+ const { writeConfig: writeConfig2 } = await Promise.resolve().then(() => (init_facade5(), exports_facade2));
3866
3922
  writeConfig2(config2);
3867
3923
  console.log(`✓ Joined "${invite.payload.mesh_slug}"${enroll.alreadyMember ? " (already member)" : ""}`);
3868
3924
  }
@@ -3909,12 +3965,12 @@ async function runLaunch(flags, rawArgs) {
3909
3965
  Timed out waiting for sign-in.`);
3910
3966
  process.exit(1);
3911
3967
  }
3912
- const { generateKeypair: generateKeypair4 } = await Promise.resolve().then(() => (init_facade6(), exports_facade4));
3968
+ const { generateKeypair: generateKeypair4 } = await Promise.resolve().then(() => (init_facade7(), exports_facade4));
3913
3969
  const keypair = await generateKeypair4();
3914
- const displayNameForSync = args.name ?? `${hostname2()}-${process.pid}`;
3915
- const { syncWithBroker: syncWithBroker2 } = await Promise.resolve().then(() => (init_facade5(), exports_facade3));
3970
+ const displayNameForSync = args.name ?? `${hostname3()}-${process.pid}`;
3971
+ const { syncWithBroker: syncWithBroker2 } = await Promise.resolve().then(() => (init_facade6(), exports_facade3));
3916
3972
  const result2 = await syncWithBroker2(syncToken, keypair.publicKey, displayNameForSync);
3917
- const { writeConfig: writeConfig2 } = await Promise.resolve().then(() => (init_facade4(), exports_facade2));
3973
+ const { writeConfig: writeConfig2 } = await Promise.resolve().then(() => (init_facade5(), exports_facade2));
3918
3974
  for (const m of result2.meshes) {
3919
3975
  config.meshes.push({
3920
3976
  meshId: m.mesh_id,
@@ -3951,7 +4007,7 @@ async function runLaunch(flags, rawArgs) {
3951
4007
  } else {
3952
4008
  mesh = null;
3953
4009
  }
3954
- const displayName = args.name ?? `${hostname2()}-${process.pid}`;
4010
+ const displayName = args.name ?? `${hostname3()}-${process.pid}`;
3955
4011
  let role = args.role;
3956
4012
  let parsedGroups = args.groups ? parseGroupsString(args.groups) : [];
3957
4013
  let messageMode = args.messageMode ?? "push";
@@ -4177,10 +4233,10 @@ async function runLaunch(flags, rawArgs) {
4177
4233
  process.exit(result.status ?? 0);
4178
4234
  }
4179
4235
  var init_launch = __esm(() => {
4180
- init_facade4();
4181
4236
  init_facade5();
4182
- init_facade3();
4183
- init_facade8();
4237
+ init_facade6();
4238
+ init_facade4();
4239
+ init_facade9();
4184
4240
  init_styles();
4185
4241
  init_screen();
4186
4242
  init_spinner();
@@ -7231,8 +7287,8 @@ async function startServiceProxy(serviceName) {
7231
7287
  var peerNameCache, peerNameCacheAge = 0, CACHE_TTL_MS = 30000;
7232
7288
  var init_server = __esm(() => {
7233
7289
  init_definitions();
7234
- init_facade4();
7235
- init_facade8();
7290
+ init_facade5();
7291
+ init_facade9();
7236
7292
  peerNameCache = new Map;
7237
7293
  });
7238
7294
 
@@ -7273,7 +7329,7 @@ async function logout2() {
7273
7329
  }
7274
7330
  }
7275
7331
  var init_logout = __esm(() => {
7276
- init_facade5();
7332
+ init_facade6();
7277
7333
  init_styles();
7278
7334
  init_exit_codes();
7279
7335
  });
@@ -7303,14 +7359,14 @@ async function whoami(opts) {
7303
7359
  return EXIT.SUCCESS;
7304
7360
  }
7305
7361
  var init_whoami = __esm(() => {
7306
- init_facade5();
7362
+ init_facade6();
7307
7363
  init_styles();
7308
7364
  init_exit_codes();
7309
7365
  });
7310
7366
 
7311
7367
  // src/services/mesh/list.ts
7312
7368
  var init_list = __esm(() => {
7313
- init_facade4();
7369
+ init_facade5();
7314
7370
  });
7315
7371
 
7316
7372
  // src/services/mesh/create.ts
@@ -7335,9 +7391,9 @@ async function createMesh2(name, opts) {
7335
7391
  }
7336
7392
  var init_create = __esm(() => {
7337
7393
  init_facade2();
7338
- init_facade5();
7339
7394
  init_facade6();
7340
- init_facade4();
7395
+ init_facade7();
7396
+ init_facade5();
7341
7397
  init_urls();
7342
7398
  });
7343
7399
 
@@ -7350,44 +7406,44 @@ async function renameMesh2(slug, newName) {
7350
7406
  }
7351
7407
  var init_rename = __esm(() => {
7352
7408
  init_facade2();
7353
- init_facade5();
7409
+ init_facade6();
7354
7410
  });
7355
7411
 
7356
7412
  // src/services/mesh/leave.ts
7357
7413
  var init_leave = __esm(() => {
7358
- init_facade4();
7414
+ init_facade5();
7359
7415
  });
7360
7416
 
7361
7417
  // src/services/mesh/join.ts
7362
7418
  var init_join2 = __esm(() => {
7363
7419
  init_facade2();
7364
- init_facade6();
7365
- init_facade4();
7420
+ init_facade7();
7421
+ init_facade5();
7366
7422
  init_urls();
7367
7423
  });
7368
7424
 
7369
7425
  // src/services/state/last-used.ts
7370
7426
  var init_last_used = __esm(() => {
7371
7427
  init_paths();
7372
- init_facade4();
7428
+ init_facade5();
7373
7429
  });
7374
7430
 
7375
7431
  // src/services/state/facade.ts
7376
- var init_facade9 = __esm(() => {
7432
+ var init_facade10 = __esm(() => {
7377
7433
  init_last_used();
7378
7434
  });
7379
7435
 
7380
7436
  // src/services/mesh/resolve-target.ts
7381
7437
  var init_resolve_target = __esm(() => {
7382
- init_facade4();
7383
- init_facade9();
7438
+ init_facade5();
7439
+ init_facade10();
7384
7440
  });
7385
7441
 
7386
7442
  // src/services/mesh/errors.ts
7387
7443
  var init_errors5 = () => {};
7388
7444
 
7389
7445
  // src/services/mesh/facade.ts
7390
- var init_facade10 = __esm(() => {
7446
+ var init_facade11 = __esm(() => {
7391
7447
  init_list();
7392
7448
  init_create();
7393
7449
  init_rename();
@@ -7431,17 +7487,17 @@ async function newMesh(name, opts) {
7431
7487
  }
7432
7488
  }
7433
7489
  var init_new = __esm(() => {
7434
- init_facade10();
7490
+ init_facade11();
7435
7491
  init_styles();
7436
7492
  init_exit_codes();
7437
7493
  });
7438
7494
 
7439
7495
  // src/services/clipboard/read.ts
7440
7496
  import { execSync } from "node:child_process";
7441
- import { platform as platform3 } from "node:os";
7497
+ import { platform as platform4 } from "node:os";
7442
7498
  function writeClipboard(text2) {
7443
7499
  try {
7444
- const os = platform3();
7500
+ const os = platform4();
7445
7501
  if (os === "darwin") {
7446
7502
  execSync("pbcopy", { input: text2 });
7447
7503
  return true;
@@ -7466,7 +7522,7 @@ function writeClipboard(text2) {
7466
7522
  var init_read2 = () => {};
7467
7523
 
7468
7524
  // src/services/clipboard/facade.ts
7469
- var init_facade11 = __esm(() => {
7525
+ var init_facade12 = __esm(() => {
7470
7526
  init_read2();
7471
7527
  });
7472
7528
 
@@ -7519,10 +7575,10 @@ async function invite(email, opts = {}) {
7519
7575
  }
7520
7576
  }
7521
7577
  var init_invite = __esm(() => {
7522
- init_facade5();
7578
+ init_facade6();
7523
7579
  init_facade2();
7524
- init_facade4();
7525
- init_facade11();
7580
+ init_facade5();
7581
+ init_facade12();
7526
7582
  init_styles();
7527
7583
  init_exit_codes();
7528
7584
  });
@@ -7555,7 +7611,7 @@ function runList() {
7555
7611
  console.log(`Config: ${getConfigPath()}`);
7556
7612
  }
7557
7613
  var init_list2 = __esm(() => {
7558
- init_facade4();
7614
+ init_facade5();
7559
7615
  });
7560
7616
 
7561
7617
  // src/commands/leave.ts
@@ -7580,7 +7636,7 @@ function runLeave(args) {
7580
7636
  console.log(`Left mesh "${slug}". Remaining: ${config.meshes.length}`);
7581
7637
  }
7582
7638
  var init_leave2 = __esm(() => {
7583
- init_facade4();
7639
+ init_facade5();
7584
7640
  });
7585
7641
 
7586
7642
  // src/commands/rename.ts
@@ -7599,13 +7655,13 @@ async function rename(slug, newName) {
7599
7655
  }
7600
7656
  }
7601
7657
  var init_rename2 = __esm(() => {
7602
- init_facade10();
7658
+ init_facade11();
7603
7659
  init_styles();
7604
7660
  init_exit_codes();
7605
7661
  });
7606
7662
 
7607
7663
  // src/commands/connect.ts
7608
- import { hostname as hostname3 } from "node:os";
7664
+ import { hostname as hostname4 } from "node:os";
7609
7665
  import { createInterface as createInterface4 } from "node:readline";
7610
7666
  async function pickMesh2(meshes) {
7611
7667
  console.log(`
@@ -7647,7 +7703,7 @@ async function withMesh(opts, fn) {
7647
7703
  } else {
7648
7704
  mesh = await pickMesh2(config.meshes);
7649
7705
  }
7650
- const displayName = opts.displayName ?? config.displayName ?? `${hostname3()}-${process.pid}`;
7706
+ const displayName = opts.displayName ?? config.displayName ?? `${hostname4()}-${process.pid}`;
7651
7707
  const client = new BrokerClient(mesh, { displayName });
7652
7708
  try {
7653
7709
  await client.connect();
@@ -7658,8 +7714,8 @@ async function withMesh(opts, fn) {
7658
7714
  }
7659
7715
  }
7660
7716
  var init_connect = __esm(() => {
7661
- init_facade8();
7662
- init_facade4();
7717
+ init_facade9();
7718
+ init_facade5();
7663
7719
  });
7664
7720
 
7665
7721
  // src/commands/peers.ts
@@ -7725,7 +7781,7 @@ async function runPeers(flags) {
7725
7781
  }
7726
7782
  var init_peers = __esm(() => {
7727
7783
  init_connect();
7728
- init_facade4();
7784
+ init_facade5();
7729
7785
  });
7730
7786
 
7731
7787
  // src/commands/send.ts
@@ -7909,9 +7965,9 @@ async function runInfo(flags) {
7909
7965
  }
7910
7966
  });
7911
7967
  }
7912
- var init_info = __esm(() => {
7968
+ var init_info2 = __esm(() => {
7913
7969
  init_connect();
7914
- init_facade4();
7970
+ init_facade5();
7915
7971
  });
7916
7972
 
7917
7973
  // src/commands/remember.ts
@@ -7939,7 +7995,7 @@ async function remember(content, opts = {}) {
7939
7995
  return EXIT.INTERNAL_ERROR;
7940
7996
  }
7941
7997
  var init_remember = __esm(() => {
7942
- init_facade8();
7998
+ init_facade9();
7943
7999
  init_exit_codes();
7944
8000
  });
7945
8001
 
@@ -7973,7 +8029,7 @@ async function recall(query, opts = {}) {
7973
8029
  return EXIT.SUCCESS;
7974
8030
  }
7975
8031
  var init_recall = __esm(() => {
7976
- init_facade8();
8032
+ init_facade9();
7977
8033
  init_styles();
7978
8034
  init_exit_codes();
7979
8035
  });
@@ -8200,7 +8256,7 @@ function printProfile(member, dim2) {
8200
8256
  console.log(` Mesh: ${dim2(String(member.id ?? ""))}`);
8201
8257
  }
8202
8258
  var init_profile = __esm(() => {
8203
- init_facade4();
8259
+ init_facade5();
8204
8260
  });
8205
8261
 
8206
8262
  // src/commands/status.ts
@@ -8288,7 +8344,7 @@ async function runStatus() {
8288
8344
  }
8289
8345
  }
8290
8346
  var init_status = __esm(() => {
8291
- init_facade4();
8347
+ init_facade5();
8292
8348
  init_urls();
8293
8349
  });
8294
8350
 
@@ -8298,7 +8354,7 @@ __export(exports_doctor, {
8298
8354
  runDoctor: () => runDoctor
8299
8355
  });
8300
8356
  import { existsSync as existsSync6, readFileSync as readFileSync4, statSync as statSync3 } from "node:fs";
8301
- import { homedir as homedir4, platform as platform4 } from "node:os";
8357
+ import { homedir as homedir4, platform as platform5 } from "node:os";
8302
8358
  import { join as join4 } from "node:path";
8303
8359
  import { spawnSync as spawnSync3 } from "node:child_process";
8304
8360
  function checkNode() {
@@ -8311,7 +8367,7 @@ function checkNode() {
8311
8367
  };
8312
8368
  }
8313
8369
  function checkClaudeOnPath() {
8314
- const res = platform4() === "win32" ? spawnSync3("where", ["claude"]) : spawnSync3("sh", ["-c", "command -v claude"]);
8370
+ const res = platform5() === "win32" ? spawnSync3("where", ["claude"]) : spawnSync3("sh", ["-c", "command -v claude"]);
8315
8371
  const onPath = res.status === 0;
8316
8372
  const location = onPath ? res.stdout.toString().trim().split(`
8317
8373
  `)[0] : undefined;
@@ -8386,11 +8442,11 @@ function checkConfigFile() {
8386
8442
  readConfig();
8387
8443
  const st = statSync3(path);
8388
8444
  const mode = (st.mode & 511).toString(8);
8389
- const secure = platform4() === "win32" || mode === "600";
8445
+ const secure = platform5() === "win32" || mode === "600";
8390
8446
  return {
8391
8447
  name: "~/.claudemesh/config.json parses + chmod 0600",
8392
8448
  pass: secure,
8393
- detail: platform4() === "win32" ? "chmod skipped on Windows" : `0${mode}`,
8449
+ detail: platform5() === "win32" ? "chmod skipped on Windows" : `0${mode}`,
8394
8450
  fix: secure ? undefined : `chmod 600 ${path}`
8395
8451
  };
8396
8452
  } catch (e) {
@@ -8477,7 +8533,7 @@ async function runDoctor() {
8477
8533
  }
8478
8534
  }
8479
8535
  var init_doctor = __esm(() => {
8480
- init_facade4();
8536
+ init_facade5();
8481
8537
  init_urls();
8482
8538
  });
8483
8539
 
@@ -8495,7 +8551,7 @@ import {
8495
8551
  readFileSync as readFileSync5,
8496
8552
  writeFileSync as writeFileSync5
8497
8553
  } from "node:fs";
8498
- import { homedir as homedir5, platform as platform5 } from "node:os";
8554
+ import { homedir as homedir5, platform as platform6 } from "node:os";
8499
8555
  import { dirname as dirname2, join as join5, resolve } from "node:path";
8500
8556
  import { fileURLToPath } from "node:url";
8501
8557
  import { spawnSync as spawnSync4 } from "node:child_process";
@@ -8562,7 +8618,7 @@ function flushClaudeConfig(obj) {
8562
8618
  } catch {}
8563
8619
  }
8564
8620
  function bunAvailable() {
8565
- const res = platform5() === "win32" ? spawnSync4("where", ["bun"]) : spawnSync4("sh", ["-c", "command -v bun"]);
8621
+ const res = platform6() === "win32" ? spawnSync4("where", ["bun"]) : spawnSync4("sh", ["-c", "command -v bun"]);
8566
8622
  return res.status === 0;
8567
8623
  }
8568
8624
  function resolveEntry() {
@@ -8788,7 +8844,7 @@ function runUninstall() {
8788
8844
  }
8789
8845
  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;
8790
8846
  var init_install = __esm(() => {
8791
- init_facade4();
8847
+ init_facade5();
8792
8848
  CLAUDE_CONFIG = join5(homedir5(), ".claude.json");
8793
8849
  CLAUDE_SETTINGS = join5(homedir5(), ".claude", "settings.json");
8794
8850
  CLAUDEMESH_TOOLS = [
@@ -8910,7 +8966,7 @@ __export(exports_sync, {
8910
8966
  runSync: () => runSync
8911
8967
  });
8912
8968
  import { createInterface as createInterface5 } from "node:readline";
8913
- import { hostname as hostname4 } from "node:os";
8969
+ import { hostname as hostname5 } from "node:os";
8914
8970
  async function runSync(args) {
8915
8971
  const useColor = !process.env.NO_COLOR && process.env.TERM !== "dumb" && process.stdout.isTTY;
8916
8972
  const dim2 = (s) => useColor ? `\x1B[2m${s}\x1B[22m` : s;
@@ -8944,7 +9000,7 @@ async function runSync(args) {
8944
9000
  process.exit(1);
8945
9001
  }
8946
9002
  const keypair = config.meshes.length > 0 ? { publicKey: config.meshes[0].pubkey, secretKey: config.meshes[0].secretKey } : await generateKeypair3();
8947
- const displayName = config.displayName ?? `${hostname4()}-${process.pid}`;
9003
+ const displayName = config.displayName ?? `${hostname5()}-${process.pid}`;
8948
9004
  const result = await syncWithBroker(syncToken, keypair.publicKey, displayName);
8949
9005
  let added = 0;
8950
9006
  for (const m of result.meshes) {
@@ -8971,10 +9027,10 @@ async function runSync(args) {
8971
9027
  }
8972
9028
  }
8973
9029
  var init_sync = __esm(() => {
8974
- init_facade4();
8975
9030
  init_facade5();
8976
- init_facade3();
8977
9031
  init_facade6();
9032
+ init_facade4();
9033
+ init_facade7();
8978
9034
  });
8979
9035
 
8980
9036
  // src/commands/hook.ts
@@ -9057,7 +9113,7 @@ async function runHook(args) {
9057
9113
  }
9058
9114
  var DEBUG;
9059
9115
  var init_hook = __esm(() => {
9060
- init_facade4();
9116
+ init_facade5();
9061
9117
  DEBUG = process.env.CLAUDEMESH_HOOK_DEBUG === "1";
9062
9118
  });
9063
9119
 
@@ -9091,7 +9147,7 @@ function runSeedTestMesh(args) {
9091
9147
  console.log(`Run \`claudemesh mcp\` to connect, or register with Claude Code via \`claudemesh install\`.`);
9092
9148
  }
9093
9149
  var init_seed_test_mesh = __esm(() => {
9094
- init_facade4();
9150
+ init_facade5();
9095
9151
  });
9096
9152
 
9097
9153
  // ../../node_modules/qrcode-terminal/vendor/QRCode/QRMode.js
@@ -10165,7 +10221,7 @@ async function connectTelegram(args) {
10165
10221
  }
10166
10222
  }
10167
10223
  var init_connect_telegram = __esm(() => {
10168
- init_facade4();
10224
+ init_facade5();
10169
10225
  });
10170
10226
 
10171
10227
  // src/cli/argv.ts
@@ -10367,7 +10423,7 @@ async function main() {
10367
10423
  await runJoin2([command]);
10368
10424
  return;
10369
10425
  }
10370
- const { readConfig: readConfig2 } = await Promise.resolve().then(() => (init_facade4(), exports_facade2));
10426
+ const { readConfig: readConfig2 } = await Promise.resolve().then(() => (init_facade5(), exports_facade2));
10371
10427
  const config = readConfig2();
10372
10428
  if (config.meshes.length === 0) {
10373
10429
  const { runWelcome: runWelcome2 } = await Promise.resolve().then(() => (init_welcome2(), exports_welcome));
@@ -10472,7 +10528,7 @@ async function main() {
10472
10528
  break;
10473
10529
  }
10474
10530
  case "info": {
10475
- const { runInfo: runInfo2 } = await Promise.resolve().then(() => (init_info(), exports_info));
10531
+ const { runInfo: runInfo2 } = await Promise.resolve().then(() => (init_info2(), exports_info));
10476
10532
  await runInfo2({});
10477
10533
  break;
10478
10534
  }
@@ -10558,4 +10614,4 @@ main().catch((err) => {
10558
10614
  process.exit(EXIT.INTERNAL_ERROR);
10559
10615
  });
10560
10616
 
10561
- //# debugId=CD07DBA798B645E164756E2164756E21
10617
+ //# debugId=1511E5E3A793570664756E2164756E21