claudemesh-cli 1.0.0-alpha.33 → 1.0.0-alpha.35

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.
@@ -88,7 +88,7 @@ __export(exports_urls, {
88
88
  VERSION: () => VERSION,
89
89
  URLS: () => URLS
90
90
  });
91
- var URLS, VERSION = "1.0.0-alpha.33", env;
91
+ var URLS, VERSION = "1.0.0-alpha.35", env;
92
92
  var init_urls = __esm(() => {
93
93
  URLS = {
94
94
  BROKER: process.env.CLAUDEMESH_BROKER_URL ?? "wss://ic.claudemesh.com/ws",
@@ -2479,10 +2479,9 @@ class BrokerClient {
2479
2479
  if (msg.type === "ack") {
2480
2480
  const pending = this.pendingSends.get(String(msg.id ?? ""));
2481
2481
  if (pending) {
2482
- pending.resolve({
2483
- ok: true,
2484
- messageId: String(msg.messageId ?? "")
2485
- });
2482
+ const queued = msg.queued !== false;
2483
+ const errStr = typeof msg.error === "string" ? msg.error : undefined;
2484
+ pending.resolve(queued ? { ok: true, messageId: String(msg.messageId ?? "") } : { ok: false, error: errStr ?? "broker rejected send" });
2486
2485
  this.pendingSends.delete(pending.id);
2487
2486
  }
2488
2487
  return;
@@ -2522,7 +2521,13 @@ class BrokerClient {
2522
2521
  plaintext = `[${event}]`;
2523
2522
  }
2524
2523
  } else if (senderPubkey && nonce && ciphertext) {
2525
- plaintext = await decryptDirect({ nonce, ciphertext }, senderPubkey, this.sessionSecretKey ?? this.mesh.secretKey);
2524
+ const envelope = { nonce, ciphertext };
2525
+ if (this.sessionSecretKey) {
2526
+ plaintext = await decryptDirect(envelope, senderPubkey, this.sessionSecretKey);
2527
+ }
2528
+ if (plaintext === null) {
2529
+ plaintext = await decryptDirect(envelope, senderPubkey, this.mesh.secretKey);
2530
+ }
2526
2531
  }
2527
2532
  if (plaintext === null && ciphertext && !senderPubkey) {
2528
2533
  try {
@@ -12484,4 +12489,4 @@ main().catch((err) => {
12484
12489
  process.exit(EXIT.INTERNAL_ERROR);
12485
12490
  });
12486
12491
 
12487
- //# debugId=7971C6A86DFF7B3F64756E2164756E21
12492
+ //# debugId=5BA2A4C8E9E8C67464756E2164756E21