@marshell/cli 0.7.2 → 0.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bridge.js CHANGED
@@ -396,7 +396,7 @@ async function handleInbound(networkUrl, msg, options) {
396
396
  created_at: msg.created_at,
397
397
  pending: pending ?? undefined,
398
398
  });
399
- // Push to human channel (Telegram, webhook, etc.) side effect only.
399
+ // Push to human channel. On failure, leave message in inbox for `relay cron`.
400
400
  if (options.notify && !isEcho(msg.from, msg.text)) {
401
401
  try {
402
402
  await runNotifyCommand(options.notify, msg, pending);
@@ -418,9 +418,10 @@ async function handleInbound(networkUrl, msg, options) {
418
418
  message: `notify: ${message}`,
419
419
  in_reply_to: msg.id,
420
420
  });
421
+ // Do not ack — cron will retry delivery to the human.
422
+ return;
421
423
  }
422
424
  }
423
- // Always ack so backlog never sticks.
424
425
  await (0, network_1.ackMessages)(networkUrl, [msg.id]);
425
426
  // Drop echoes of our own recent outbound (hi↔hi loops).
426
427
  if (isEcho(msg.from, msg.text)) {
package/dist/cli.js CHANGED
@@ -384,18 +384,14 @@ async function cmdRelay(args) {
384
384
  });
385
385
  return;
386
386
  }
387
- if (result.message && result.relayed.length === 0) {
388
- process.stdout.write(`${result.message}\n`);
389
- return;
390
- }
391
- if (result.relayed.length === 0) {
392
- process.stdout.write("Nothing new to relay.\n");
387
+ if (result.relayed.length > 0) {
388
+ if (result.pending_count === 0 && !pendingOnly) {
389
+ process.stdout.write(`${result.relayed.length} new inbound message(s):\n\n`);
390
+ }
391
+ process.stdout.write(`${(0, relay_cron_1.formatRelayOutput)(result.relayed)}\n`);
393
392
  return;
394
393
  }
395
- if (result.pending_count === 0 && !pendingOnly) {
396
- process.stdout.write(`${result.relayed.length} new inbound message(s):\n\n`);
397
- }
398
- process.stdout.write(`${(0, relay_cron_1.formatRelayOutput)(result.relayed)}\n`);
394
+ process.stdout.write(result.message ?? "Nothing new to relay.\n");
399
395
  }
400
396
  async function cmdPending(args) {
401
397
  const json = hasFlag(args, "--json");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marshell/cli",
3
- "version": "0.7.2",
3
+ "version": "0.7.4",
4
4
  "description": "Marshell CLI — join a subnet, discover agents, send messages",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",
package/scripts/relay.mjs CHANGED
@@ -58,11 +58,21 @@ async function main() {
58
58
  process.exit(0);
59
59
  }
60
60
 
61
- if (format === "json") {
62
- process.stdout.write(`${JSON.stringify({ ...payload, message })}\n`);
63
- } else {
64
- process.stdout.write(`${message}\n`);
61
+ // Without a webhook, stdout is only a log — not human delivery. Fail so
62
+ // listener leaves inbox intact and `marshell relay cron` can deliver.
63
+ if (process.env.MARSHELL_ALLOW_STDOUT_RELAY === "1") {
64
+ if (format === "json") {
65
+ process.stdout.write(`${JSON.stringify({ ...payload, message })}\n`);
66
+ } else {
67
+ process.stdout.write(`${message}\n`);
68
+ }
69
+ process.exit(0);
65
70
  }
71
+
72
+ process.stderr.write(
73
+ "relay: MARSHELL_NOTIFY_WEBHOOK not set — use relay cron for human delivery\n",
74
+ );
75
+ process.exit(1);
66
76
  }
67
77
 
68
78
  main().catch((err) => {