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

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,55 @@ 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}`;
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
+ });
623
611
  log(`
624
612
  Opening browser for sign-in…
625
613
  `);
626
614
  log(` If your browser didn't open, visit:`);
627
- log(` ${authUrl}
615
+ log(` ${verification_url}?code=${user_code}
628
616
  `);
629
617
  log(` Waiting for confirmation…
630
618
  `);
631
619
  try {
632
- await openBrowser(authUrl);
620
+ await openBrowser(`${verification_url}?code=${user_code}`);
633
621
  } catch {
634
622
  warn("Could not open browser automatically.");
635
623
  }
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
- };
624
+ const startTime = Date.now();
625
+ while (Date.now() - startTime < TIMINGS.DEVICE_CODE_TIMEOUT_MS) {
626
+ await new Promise((r) => setTimeout(r, TIMINGS.DEVICE_CODE_POLL_MS));
627
+ let poll;
628
+ try {
629
+ poll = await exports_public.pollDeviceCode(device_code);
630
+ } catch {
631
+ continue;
655
632
  }
656
- } catch {}
657
- storeToken({
658
- session_token: token,
659
- user,
660
- token_source: "callback"
661
- });
662
- return { user, session_token: token };
633
+ if (poll.status === "approved" && poll.session_token && poll.user) {
634
+ storeToken({
635
+ session_token: poll.session_token,
636
+ user: poll.user,
637
+ token_source: "device-code"
638
+ });
639
+ return { user: poll.user, session_token: poll.session_token };
640
+ }
641
+ if (poll.status === "expired") {
642
+ throw new DeviceCodeExpired;
643
+ }
644
+ }
645
+ throw new DeviceCodeExpired;
663
646
  }
664
647
  var init_device_code = __esm(() => {
665
- init_urls();
648
+ init_timings();
649
+ init_facade2();
666
650
  init_facade3();
651
+ init_facade4();
667
652
  init_facade();
668
653
  init_token_store();
669
- init_callback_listener();
670
654
  init_errors2();
671
655
  });
672
656
 
@@ -710,7 +694,7 @@ async function logout() {
710
694
  return { revoked };
711
695
  }
712
696
  async function register(callbackPort) {
713
- const { openBrowser: openBrowser2 } = await Promise.resolve().then(() => (init_facade3(), exports_facade));
697
+ const { openBrowser: openBrowser2 } = await Promise.resolve().then(() => (init_facade4(), exports_facade));
714
698
  const url = `https://claudemesh.com/register?source=cli&callback=http://localhost:${callbackPort}`;
715
699
  await openBrowser2(url);
716
700
  }
@@ -758,6 +742,66 @@ var init_dashboard_sync = __esm(() => {
758
742
  init_urls();
759
743
  });
760
744
 
745
+ // src/services/auth/callback-listener.ts
746
+ import { createServer } from "node:http";
747
+ function startCallbackListener() {
748
+ return new Promise((resolveStart) => {
749
+ let resolveToken;
750
+ let resolved = false;
751
+ const tokenPromise = new Promise((r) => {
752
+ resolveToken = r;
753
+ });
754
+ const server = createServer((req, res) => {
755
+ const url = new URL(req.url, "http://localhost");
756
+ if (req.method === "OPTIONS") {
757
+ res.writeHead(204, {
758
+ "Access-Control-Allow-Origin": "https://claudemesh.com",
759
+ "Access-Control-Allow-Methods": "GET",
760
+ "Access-Control-Allow-Headers": "Content-Type"
761
+ });
762
+ res.end();
763
+ return;
764
+ }
765
+ if (url.pathname === "/ping") {
766
+ res.writeHead(200, {
767
+ "Content-Type": "text/plain",
768
+ "Access-Control-Allow-Origin": "https://claudemesh.com"
769
+ });
770
+ res.end("ok");
771
+ return;
772
+ }
773
+ if (url.pathname === "/callback") {
774
+ const token = url.searchParams.get("token");
775
+ if (token && !resolved) {
776
+ resolved = true;
777
+ res.writeHead(200, {
778
+ "Content-Type": "text/html",
779
+ "Access-Control-Allow-Origin": "https://claudemesh.com"
780
+ });
781
+ res.end("<html><body><h2>Done! You can close this tab.</h2></body></html>");
782
+ resolveToken(token);
783
+ setTimeout(() => server.close(), 500);
784
+ } else {
785
+ res.writeHead(400, { "Content-Type": "text/plain" });
786
+ res.end("Missing token");
787
+ }
788
+ return;
789
+ }
790
+ res.writeHead(404);
791
+ res.end();
792
+ });
793
+ server.listen(0, "127.0.0.1", () => {
794
+ const addr = server.address();
795
+ resolveStart({
796
+ port: addr.port,
797
+ token: tokenPromise,
798
+ close: () => server.close()
799
+ });
800
+ });
801
+ });
802
+ }
803
+ var init_callback_listener = () => {};
804
+
761
805
  // src/services/auth/facade.ts
762
806
  var exports_facade3 = {};
763
807
  __export(exports_facade3, {
@@ -781,7 +825,7 @@ function generatePairingCode() {
781
825
  return Array.from(bytes, (b) => CHARS[b % CHARS.length]).join("");
782
826
  }
783
827
  var CHARS = "ABCDEFGHJKLMNPQRSTUVWXYZabcdefghjkmnpqrstuvwxyz23456789";
784
- var init_facade5 = __esm(() => {
828
+ var init_facade6 = __esm(() => {
785
829
  init_device_code();
786
830
  init_client2();
787
831
  init_dashboard_sync();
@@ -793,7 +837,7 @@ var init_facade5 = __esm(() => {
793
837
  // src/services/invite/generate.ts
794
838
  var init_generate = __esm(() => {
795
839
  init_facade2();
796
- init_facade5();
840
+ init_facade6();
797
841
  });
798
842
  // src/services/invite/errors.ts
799
843
  var init_errors3 = () => {};
@@ -952,7 +996,7 @@ async function verify(message, signatureHex, publicKeyHex) {
952
996
  return false;
953
997
  }
954
998
  }
955
- var init_facade6 = __esm(() => {
999
+ var init_facade7 = __esm(() => {
956
1000
  init_keypair();
957
1001
  init_file_crypto();
958
1002
  init_box();
@@ -1050,7 +1094,7 @@ async function parseInviteLink2(link) {
1050
1094
  return { payload, raw: link, token: encoded };
1051
1095
  }
1052
1096
  var init_parse_v1 = __esm(() => {
1053
- init_facade6();
1097
+ init_facade7();
1054
1098
  });
1055
1099
 
1056
1100
  // src/services/invite/enroll.ts
@@ -1173,7 +1217,7 @@ function parseV2InviteInput(input) {
1173
1217
  var init_v2 = () => {};
1174
1218
 
1175
1219
  // src/services/invite/facade.ts
1176
- var init_facade7 = __esm(() => {
1220
+ var init_facade8 = __esm(() => {
1177
1221
  init_generate();
1178
1222
  init_errors3();
1179
1223
  init_parse_v1();
@@ -1188,7 +1232,7 @@ __export(exports_join, {
1188
1232
  import sodium3 from "libsodium-wrappers";
1189
1233
  import { writeFileSync as writeFileSync3, mkdirSync as mkdirSync2 } from "node:fs";
1190
1234
  import { join as join2, dirname } from "node:path";
1191
- import { homedir as homedir2, hostname } from "node:os";
1235
+ import { homedir as homedir2, hostname as hostname2 } from "node:os";
1192
1236
  function deriveAppBaseUrl() {
1193
1237
  const override = process.env.CLAUDEMESH_APP_URL;
1194
1238
  if (override)
@@ -1213,7 +1257,7 @@ async function runJoinV2(code) {
1213
1257
  process.exit(1);
1214
1258
  }
1215
1259
  const keypair = await generateKeypair3();
1216
- const displayName = `${hostname()}-${process.pid}`;
1260
+ const displayName = `${hostname2()}-${process.pid}`;
1217
1261
  await sodium3.ready;
1218
1262
  const rootKeyB64 = sodium3.to_base64(claim.rootKey, sodium3.base64_variants.URLSAFE_NO_PADDING);
1219
1263
  const fallbackSlug = `mesh-${claim.meshId.slice(0, 8)}`;
@@ -1267,7 +1311,7 @@ async function runJoin(args) {
1267
1311
  const { payload, token } = invite;
1268
1312
  console.log(`Joining mesh "${payload.mesh_slug}" (${payload.mesh_id})…`);
1269
1313
  const keypair = await generateKeypair3();
1270
- const displayName = `${hostname()}-${process.pid}`;
1314
+ const displayName = `${hostname2()}-${process.pid}`;
1271
1315
  let enroll;
1272
1316
  try {
1273
1317
  enroll = await enrollWithBroker2({
@@ -1310,11 +1354,11 @@ async function runJoin(args) {
1310
1354
  console.log("Restart Claude Code to pick up the new mesh.");
1311
1355
  }
1312
1356
  var init_join = __esm(() => {
1357
+ init_facade8();
1358
+ init_facade8();
1313
1359
  init_facade7();
1314
- init_facade7();
1315
- init_facade6();
1316
- init_facade4();
1317
- init_facade7();
1360
+ init_facade5();
1361
+ init_facade8();
1318
1362
  init_urls();
1319
1363
  });
1320
1364
 
@@ -1369,7 +1413,7 @@ async function login() {
1369
1413
  }
1370
1414
  }
1371
1415
  var init_login = __esm(() => {
1372
- init_facade5();
1416
+ init_facade6();
1373
1417
  init_facade2();
1374
1418
  init_styles();
1375
1419
  init_exit_codes();
@@ -1419,7 +1463,7 @@ async function runWelcome() {
1419
1463
  });
1420
1464
  }
1421
1465
  var init_welcome2 = __esm(() => {
1422
- init_facade4();
1466
+ init_facade5();
1423
1467
  init_welcome();
1424
1468
  init_login();
1425
1469
  init_register();
@@ -1435,7 +1479,7 @@ async function signHello(meshId, memberId, pubkey, secretKeyHex) {
1435
1479
  return { timestamp: timestamp2, signature: s.to_hex(sig) };
1436
1480
  }
1437
1481
  var init_hello_sig = __esm(() => {
1438
- init_facade6();
1482
+ init_facade7();
1439
1483
  });
1440
1484
 
1441
1485
  // src/services/broker/ws-client.ts
@@ -3386,9 +3430,9 @@ function randomNonce() {
3386
3430
  }
3387
3431
  var MAX_QUEUED = 100, HELLO_ACK_TIMEOUT_MS = 5000, BACKOFF_CAPS;
3388
3432
  var init_ws_client = __esm(() => {
3389
- init_facade6();
3433
+ init_facade7();
3390
3434
  init_hello_sig();
3391
- init_facade6();
3435
+ init_facade7();
3392
3436
  BACKOFF_CAPS = [1000, 2000, 4000, 8000, 16000, 30000];
3393
3437
  });
3394
3438
 
@@ -3445,14 +3489,14 @@ var init_manager = __esm(() => {
3445
3489
 
3446
3490
  // src/services/broker/envelope.ts
3447
3491
  var init_envelope = __esm(() => {
3448
- init_facade6();
3492
+ init_facade7();
3449
3493
  });
3450
3494
 
3451
3495
  // src/services/broker/errors.ts
3452
3496
  var init_errors4 = () => {};
3453
3497
 
3454
3498
  // src/services/broker/facade.ts
3455
- var init_facade8 = __esm(() => {
3499
+ var init_facade9 = __esm(() => {
3456
3500
  init_ws_client();
3457
3501
  init_manager();
3458
3502
  init_hello_sig();
@@ -3634,7 +3678,7 @@ __export(exports_launch, {
3634
3678
  import { spawnSync as spawnSync2 } from "node:child_process";
3635
3679
  import { randomUUID } from "node:crypto";
3636
3680
  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";
3681
+ import { tmpdir, hostname as hostname3, homedir as homedir3 } from "node:os";
3638
3682
  import { join as join3 } from "node:path";
3639
3683
  import { createInterface as createInterface3 } from "node:readline";
3640
3684
  async function pickMesh(meshes) {
@@ -3842,7 +3886,7 @@ async function runLaunch(flags, rawArgs) {
3842
3886
  console.log("Joining mesh...");
3843
3887
  const invite = await parseInviteLink(args.joinLink);
3844
3888
  const keypair = await generateKeypair();
3845
- const displayName2 = args.name ?? `${hostname2()}-${process.pid}`;
3889
+ const displayName2 = args.name ?? `${hostname3()}-${process.pid}`;
3846
3890
  const enroll = await enrollWithBroker({
3847
3891
  brokerWsUrl: invite.payload.broker_url,
3848
3892
  inviteToken: invite.token,
@@ -3862,7 +3906,7 @@ async function runLaunch(flags, rawArgs) {
3862
3906
  brokerUrl: invite.payload.broker_url,
3863
3907
  joinedAt: new Date().toISOString()
3864
3908
  });
3865
- const { writeConfig: writeConfig2 } = await Promise.resolve().then(() => (init_facade4(), exports_facade2));
3909
+ const { writeConfig: writeConfig2 } = await Promise.resolve().then(() => (init_facade5(), exports_facade2));
3866
3910
  writeConfig2(config2);
3867
3911
  console.log(`✓ Joined "${invite.payload.mesh_slug}"${enroll.alreadyMember ? " (already member)" : ""}`);
3868
3912
  }
@@ -3909,12 +3953,12 @@ async function runLaunch(flags, rawArgs) {
3909
3953
  Timed out waiting for sign-in.`);
3910
3954
  process.exit(1);
3911
3955
  }
3912
- const { generateKeypair: generateKeypair4 } = await Promise.resolve().then(() => (init_facade6(), exports_facade4));
3956
+ const { generateKeypair: generateKeypair4 } = await Promise.resolve().then(() => (init_facade7(), exports_facade4));
3913
3957
  const keypair = await generateKeypair4();
3914
- const displayNameForSync = args.name ?? `${hostname2()}-${process.pid}`;
3915
- const { syncWithBroker: syncWithBroker2 } = await Promise.resolve().then(() => (init_facade5(), exports_facade3));
3958
+ const displayNameForSync = args.name ?? `${hostname3()}-${process.pid}`;
3959
+ const { syncWithBroker: syncWithBroker2 } = await Promise.resolve().then(() => (init_facade6(), exports_facade3));
3916
3960
  const result2 = await syncWithBroker2(syncToken, keypair.publicKey, displayNameForSync);
3917
- const { writeConfig: writeConfig2 } = await Promise.resolve().then(() => (init_facade4(), exports_facade2));
3961
+ const { writeConfig: writeConfig2 } = await Promise.resolve().then(() => (init_facade5(), exports_facade2));
3918
3962
  for (const m of result2.meshes) {
3919
3963
  config.meshes.push({
3920
3964
  meshId: m.mesh_id,
@@ -3951,7 +3995,7 @@ async function runLaunch(flags, rawArgs) {
3951
3995
  } else {
3952
3996
  mesh = null;
3953
3997
  }
3954
- const displayName = args.name ?? `${hostname2()}-${process.pid}`;
3998
+ const displayName = args.name ?? `${hostname3()}-${process.pid}`;
3955
3999
  let role = args.role;
3956
4000
  let parsedGroups = args.groups ? parseGroupsString(args.groups) : [];
3957
4001
  let messageMode = args.messageMode ?? "push";
@@ -4177,10 +4221,10 @@ async function runLaunch(flags, rawArgs) {
4177
4221
  process.exit(result.status ?? 0);
4178
4222
  }
4179
4223
  var init_launch = __esm(() => {
4180
- init_facade4();
4181
4224
  init_facade5();
4182
- init_facade3();
4183
- init_facade8();
4225
+ init_facade6();
4226
+ init_facade4();
4227
+ init_facade9();
4184
4228
  init_styles();
4185
4229
  init_screen();
4186
4230
  init_spinner();
@@ -7231,8 +7275,8 @@ async function startServiceProxy(serviceName) {
7231
7275
  var peerNameCache, peerNameCacheAge = 0, CACHE_TTL_MS = 30000;
7232
7276
  var init_server = __esm(() => {
7233
7277
  init_definitions();
7234
- init_facade4();
7235
- init_facade8();
7278
+ init_facade5();
7279
+ init_facade9();
7236
7280
  peerNameCache = new Map;
7237
7281
  });
7238
7282
 
@@ -7273,7 +7317,7 @@ async function logout2() {
7273
7317
  }
7274
7318
  }
7275
7319
  var init_logout = __esm(() => {
7276
- init_facade5();
7320
+ init_facade6();
7277
7321
  init_styles();
7278
7322
  init_exit_codes();
7279
7323
  });
@@ -7303,14 +7347,14 @@ async function whoami(opts) {
7303
7347
  return EXIT.SUCCESS;
7304
7348
  }
7305
7349
  var init_whoami = __esm(() => {
7306
- init_facade5();
7350
+ init_facade6();
7307
7351
  init_styles();
7308
7352
  init_exit_codes();
7309
7353
  });
7310
7354
 
7311
7355
  // src/services/mesh/list.ts
7312
7356
  var init_list = __esm(() => {
7313
- init_facade4();
7357
+ init_facade5();
7314
7358
  });
7315
7359
 
7316
7360
  // src/services/mesh/create.ts
@@ -7335,9 +7379,9 @@ async function createMesh2(name, opts) {
7335
7379
  }
7336
7380
  var init_create = __esm(() => {
7337
7381
  init_facade2();
7338
- init_facade5();
7339
7382
  init_facade6();
7340
- init_facade4();
7383
+ init_facade7();
7384
+ init_facade5();
7341
7385
  init_urls();
7342
7386
  });
7343
7387
 
@@ -7350,44 +7394,44 @@ async function renameMesh2(slug, newName) {
7350
7394
  }
7351
7395
  var init_rename = __esm(() => {
7352
7396
  init_facade2();
7353
- init_facade5();
7397
+ init_facade6();
7354
7398
  });
7355
7399
 
7356
7400
  // src/services/mesh/leave.ts
7357
7401
  var init_leave = __esm(() => {
7358
- init_facade4();
7402
+ init_facade5();
7359
7403
  });
7360
7404
 
7361
7405
  // src/services/mesh/join.ts
7362
7406
  var init_join2 = __esm(() => {
7363
7407
  init_facade2();
7364
- init_facade6();
7365
- init_facade4();
7408
+ init_facade7();
7409
+ init_facade5();
7366
7410
  init_urls();
7367
7411
  });
7368
7412
 
7369
7413
  // src/services/state/last-used.ts
7370
7414
  var init_last_used = __esm(() => {
7371
7415
  init_paths();
7372
- init_facade4();
7416
+ init_facade5();
7373
7417
  });
7374
7418
 
7375
7419
  // src/services/state/facade.ts
7376
- var init_facade9 = __esm(() => {
7420
+ var init_facade10 = __esm(() => {
7377
7421
  init_last_used();
7378
7422
  });
7379
7423
 
7380
7424
  // src/services/mesh/resolve-target.ts
7381
7425
  var init_resolve_target = __esm(() => {
7382
- init_facade4();
7383
- init_facade9();
7426
+ init_facade5();
7427
+ init_facade10();
7384
7428
  });
7385
7429
 
7386
7430
  // src/services/mesh/errors.ts
7387
7431
  var init_errors5 = () => {};
7388
7432
 
7389
7433
  // src/services/mesh/facade.ts
7390
- var init_facade10 = __esm(() => {
7434
+ var init_facade11 = __esm(() => {
7391
7435
  init_list();
7392
7436
  init_create();
7393
7437
  init_rename();
@@ -7431,17 +7475,17 @@ async function newMesh(name, opts) {
7431
7475
  }
7432
7476
  }
7433
7477
  var init_new = __esm(() => {
7434
- init_facade10();
7478
+ init_facade11();
7435
7479
  init_styles();
7436
7480
  init_exit_codes();
7437
7481
  });
7438
7482
 
7439
7483
  // src/services/clipboard/read.ts
7440
7484
  import { execSync } from "node:child_process";
7441
- import { platform as platform3 } from "node:os";
7485
+ import { platform as platform4 } from "node:os";
7442
7486
  function writeClipboard(text2) {
7443
7487
  try {
7444
- const os = platform3();
7488
+ const os = platform4();
7445
7489
  if (os === "darwin") {
7446
7490
  execSync("pbcopy", { input: text2 });
7447
7491
  return true;
@@ -7466,7 +7510,7 @@ function writeClipboard(text2) {
7466
7510
  var init_read2 = () => {};
7467
7511
 
7468
7512
  // src/services/clipboard/facade.ts
7469
- var init_facade11 = __esm(() => {
7513
+ var init_facade12 = __esm(() => {
7470
7514
  init_read2();
7471
7515
  });
7472
7516
 
@@ -7519,10 +7563,10 @@ async function invite(email, opts = {}) {
7519
7563
  }
7520
7564
  }
7521
7565
  var init_invite = __esm(() => {
7522
- init_facade5();
7566
+ init_facade6();
7523
7567
  init_facade2();
7524
- init_facade4();
7525
- init_facade11();
7568
+ init_facade5();
7569
+ init_facade12();
7526
7570
  init_styles();
7527
7571
  init_exit_codes();
7528
7572
  });
@@ -7555,7 +7599,7 @@ function runList() {
7555
7599
  console.log(`Config: ${getConfigPath()}`);
7556
7600
  }
7557
7601
  var init_list2 = __esm(() => {
7558
- init_facade4();
7602
+ init_facade5();
7559
7603
  });
7560
7604
 
7561
7605
  // src/commands/leave.ts
@@ -7580,7 +7624,7 @@ function runLeave(args) {
7580
7624
  console.log(`Left mesh "${slug}". Remaining: ${config.meshes.length}`);
7581
7625
  }
7582
7626
  var init_leave2 = __esm(() => {
7583
- init_facade4();
7627
+ init_facade5();
7584
7628
  });
7585
7629
 
7586
7630
  // src/commands/rename.ts
@@ -7599,13 +7643,13 @@ async function rename(slug, newName) {
7599
7643
  }
7600
7644
  }
7601
7645
  var init_rename2 = __esm(() => {
7602
- init_facade10();
7646
+ init_facade11();
7603
7647
  init_styles();
7604
7648
  init_exit_codes();
7605
7649
  });
7606
7650
 
7607
7651
  // src/commands/connect.ts
7608
- import { hostname as hostname3 } from "node:os";
7652
+ import { hostname as hostname4 } from "node:os";
7609
7653
  import { createInterface as createInterface4 } from "node:readline";
7610
7654
  async function pickMesh2(meshes) {
7611
7655
  console.log(`
@@ -7647,7 +7691,7 @@ async function withMesh(opts, fn) {
7647
7691
  } else {
7648
7692
  mesh = await pickMesh2(config.meshes);
7649
7693
  }
7650
- const displayName = opts.displayName ?? config.displayName ?? `${hostname3()}-${process.pid}`;
7694
+ const displayName = opts.displayName ?? config.displayName ?? `${hostname4()}-${process.pid}`;
7651
7695
  const client = new BrokerClient(mesh, { displayName });
7652
7696
  try {
7653
7697
  await client.connect();
@@ -7658,8 +7702,8 @@ async function withMesh(opts, fn) {
7658
7702
  }
7659
7703
  }
7660
7704
  var init_connect = __esm(() => {
7661
- init_facade8();
7662
- init_facade4();
7705
+ init_facade9();
7706
+ init_facade5();
7663
7707
  });
7664
7708
 
7665
7709
  // src/commands/peers.ts
@@ -7725,7 +7769,7 @@ async function runPeers(flags) {
7725
7769
  }
7726
7770
  var init_peers = __esm(() => {
7727
7771
  init_connect();
7728
- init_facade4();
7772
+ init_facade5();
7729
7773
  });
7730
7774
 
7731
7775
  // src/commands/send.ts
@@ -7909,9 +7953,9 @@ async function runInfo(flags) {
7909
7953
  }
7910
7954
  });
7911
7955
  }
7912
- var init_info = __esm(() => {
7956
+ var init_info2 = __esm(() => {
7913
7957
  init_connect();
7914
- init_facade4();
7958
+ init_facade5();
7915
7959
  });
7916
7960
 
7917
7961
  // src/commands/remember.ts
@@ -7939,7 +7983,7 @@ async function remember(content, opts = {}) {
7939
7983
  return EXIT.INTERNAL_ERROR;
7940
7984
  }
7941
7985
  var init_remember = __esm(() => {
7942
- init_facade8();
7986
+ init_facade9();
7943
7987
  init_exit_codes();
7944
7988
  });
7945
7989
 
@@ -7973,7 +8017,7 @@ async function recall(query, opts = {}) {
7973
8017
  return EXIT.SUCCESS;
7974
8018
  }
7975
8019
  var init_recall = __esm(() => {
7976
- init_facade8();
8020
+ init_facade9();
7977
8021
  init_styles();
7978
8022
  init_exit_codes();
7979
8023
  });
@@ -8200,7 +8244,7 @@ function printProfile(member, dim2) {
8200
8244
  console.log(` Mesh: ${dim2(String(member.id ?? ""))}`);
8201
8245
  }
8202
8246
  var init_profile = __esm(() => {
8203
- init_facade4();
8247
+ init_facade5();
8204
8248
  });
8205
8249
 
8206
8250
  // src/commands/status.ts
@@ -8288,7 +8332,7 @@ async function runStatus() {
8288
8332
  }
8289
8333
  }
8290
8334
  var init_status = __esm(() => {
8291
- init_facade4();
8335
+ init_facade5();
8292
8336
  init_urls();
8293
8337
  });
8294
8338
 
@@ -8298,7 +8342,7 @@ __export(exports_doctor, {
8298
8342
  runDoctor: () => runDoctor
8299
8343
  });
8300
8344
  import { existsSync as existsSync6, readFileSync as readFileSync4, statSync as statSync3 } from "node:fs";
8301
- import { homedir as homedir4, platform as platform4 } from "node:os";
8345
+ import { homedir as homedir4, platform as platform5 } from "node:os";
8302
8346
  import { join as join4 } from "node:path";
8303
8347
  import { spawnSync as spawnSync3 } from "node:child_process";
8304
8348
  function checkNode() {
@@ -8311,7 +8355,7 @@ function checkNode() {
8311
8355
  };
8312
8356
  }
8313
8357
  function checkClaudeOnPath() {
8314
- const res = platform4() === "win32" ? spawnSync3("where", ["claude"]) : spawnSync3("sh", ["-c", "command -v claude"]);
8358
+ const res = platform5() === "win32" ? spawnSync3("where", ["claude"]) : spawnSync3("sh", ["-c", "command -v claude"]);
8315
8359
  const onPath = res.status === 0;
8316
8360
  const location = onPath ? res.stdout.toString().trim().split(`
8317
8361
  `)[0] : undefined;
@@ -8386,11 +8430,11 @@ function checkConfigFile() {
8386
8430
  readConfig();
8387
8431
  const st = statSync3(path);
8388
8432
  const mode = (st.mode & 511).toString(8);
8389
- const secure = platform4() === "win32" || mode === "600";
8433
+ const secure = platform5() === "win32" || mode === "600";
8390
8434
  return {
8391
8435
  name: "~/.claudemesh/config.json parses + chmod 0600",
8392
8436
  pass: secure,
8393
- detail: platform4() === "win32" ? "chmod skipped on Windows" : `0${mode}`,
8437
+ detail: platform5() === "win32" ? "chmod skipped on Windows" : `0${mode}`,
8394
8438
  fix: secure ? undefined : `chmod 600 ${path}`
8395
8439
  };
8396
8440
  } catch (e) {
@@ -8477,7 +8521,7 @@ async function runDoctor() {
8477
8521
  }
8478
8522
  }
8479
8523
  var init_doctor = __esm(() => {
8480
- init_facade4();
8524
+ init_facade5();
8481
8525
  init_urls();
8482
8526
  });
8483
8527
 
@@ -8495,7 +8539,7 @@ import {
8495
8539
  readFileSync as readFileSync5,
8496
8540
  writeFileSync as writeFileSync5
8497
8541
  } from "node:fs";
8498
- import { homedir as homedir5, platform as platform5 } from "node:os";
8542
+ import { homedir as homedir5, platform as platform6 } from "node:os";
8499
8543
  import { dirname as dirname2, join as join5, resolve } from "node:path";
8500
8544
  import { fileURLToPath } from "node:url";
8501
8545
  import { spawnSync as spawnSync4 } from "node:child_process";
@@ -8562,7 +8606,7 @@ function flushClaudeConfig(obj) {
8562
8606
  } catch {}
8563
8607
  }
8564
8608
  function bunAvailable() {
8565
- const res = platform5() === "win32" ? spawnSync4("where", ["bun"]) : spawnSync4("sh", ["-c", "command -v bun"]);
8609
+ const res = platform6() === "win32" ? spawnSync4("where", ["bun"]) : spawnSync4("sh", ["-c", "command -v bun"]);
8566
8610
  return res.status === 0;
8567
8611
  }
8568
8612
  function resolveEntry() {
@@ -8788,7 +8832,7 @@ function runUninstall() {
8788
8832
  }
8789
8833
  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
8834
  var init_install = __esm(() => {
8791
- init_facade4();
8835
+ init_facade5();
8792
8836
  CLAUDE_CONFIG = join5(homedir5(), ".claude.json");
8793
8837
  CLAUDE_SETTINGS = join5(homedir5(), ".claude", "settings.json");
8794
8838
  CLAUDEMESH_TOOLS = [
@@ -8910,7 +8954,7 @@ __export(exports_sync, {
8910
8954
  runSync: () => runSync
8911
8955
  });
8912
8956
  import { createInterface as createInterface5 } from "node:readline";
8913
- import { hostname as hostname4 } from "node:os";
8957
+ import { hostname as hostname5 } from "node:os";
8914
8958
  async function runSync(args) {
8915
8959
  const useColor = !process.env.NO_COLOR && process.env.TERM !== "dumb" && process.stdout.isTTY;
8916
8960
  const dim2 = (s) => useColor ? `\x1B[2m${s}\x1B[22m` : s;
@@ -8944,7 +8988,7 @@ async function runSync(args) {
8944
8988
  process.exit(1);
8945
8989
  }
8946
8990
  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}`;
8991
+ const displayName = config.displayName ?? `${hostname5()}-${process.pid}`;
8948
8992
  const result = await syncWithBroker(syncToken, keypair.publicKey, displayName);
8949
8993
  let added = 0;
8950
8994
  for (const m of result.meshes) {
@@ -8971,10 +9015,10 @@ async function runSync(args) {
8971
9015
  }
8972
9016
  }
8973
9017
  var init_sync = __esm(() => {
8974
- init_facade4();
8975
9018
  init_facade5();
8976
- init_facade3();
8977
9019
  init_facade6();
9020
+ init_facade4();
9021
+ init_facade7();
8978
9022
  });
8979
9023
 
8980
9024
  // src/commands/hook.ts
@@ -9057,7 +9101,7 @@ async function runHook(args) {
9057
9101
  }
9058
9102
  var DEBUG;
9059
9103
  var init_hook = __esm(() => {
9060
- init_facade4();
9104
+ init_facade5();
9061
9105
  DEBUG = process.env.CLAUDEMESH_HOOK_DEBUG === "1";
9062
9106
  });
9063
9107
 
@@ -9091,7 +9135,7 @@ function runSeedTestMesh(args) {
9091
9135
  console.log(`Run \`claudemesh mcp\` to connect, or register with Claude Code via \`claudemesh install\`.`);
9092
9136
  }
9093
9137
  var init_seed_test_mesh = __esm(() => {
9094
- init_facade4();
9138
+ init_facade5();
9095
9139
  });
9096
9140
 
9097
9141
  // ../../node_modules/qrcode-terminal/vendor/QRCode/QRMode.js
@@ -10165,7 +10209,7 @@ async function connectTelegram(args) {
10165
10209
  }
10166
10210
  }
10167
10211
  var init_connect_telegram = __esm(() => {
10168
- init_facade4();
10212
+ init_facade5();
10169
10213
  });
10170
10214
 
10171
10215
  // src/cli/argv.ts
@@ -10367,7 +10411,7 @@ async function main() {
10367
10411
  await runJoin2([command]);
10368
10412
  return;
10369
10413
  }
10370
- const { readConfig: readConfig2 } = await Promise.resolve().then(() => (init_facade4(), exports_facade2));
10414
+ const { readConfig: readConfig2 } = await Promise.resolve().then(() => (init_facade5(), exports_facade2));
10371
10415
  const config = readConfig2();
10372
10416
  if (config.meshes.length === 0) {
10373
10417
  const { runWelcome: runWelcome2 } = await Promise.resolve().then(() => (init_welcome2(), exports_welcome));
@@ -10472,7 +10516,7 @@ async function main() {
10472
10516
  break;
10473
10517
  }
10474
10518
  case "info": {
10475
- const { runInfo: runInfo2 } = await Promise.resolve().then(() => (init_info(), exports_info));
10519
+ const { runInfo: runInfo2 } = await Promise.resolve().then(() => (init_info2(), exports_info));
10476
10520
  await runInfo2({});
10477
10521
  break;
10478
10522
  }
@@ -10558,4 +10602,4 @@ main().catch((err) => {
10558
10602
  process.exit(EXIT.INTERNAL_ERROR);
10559
10603
  });
10560
10604
 
10561
- //# debugId=CD07DBA798B645E164756E2164756E21
10605
+ //# debugId=9CB1A759EC6A796364756E2164756E21