@marshell/cli 0.7.8 → 0.7.9

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.
Files changed (2) hide show
  1. package/dist/network.js +18 -2
  2. package/package.json +1 -1
package/dist/network.js CHANGED
@@ -15,7 +15,7 @@ exports.fetchHistory = fetchHistory;
15
15
  exports.askAgent = askAgent;
16
16
  exports.toWsUrl = toWsUrl;
17
17
  const config_1 = require("./config");
18
- exports.MARSHELL_CLI_VERSION = "0.7.8";
18
+ exports.MARSHELL_CLI_VERSION = "0.7.9";
19
19
  function formatWalletLine(wallet) {
20
20
  const parts = [];
21
21
  if (wallet.free_remaining > 0) {
@@ -270,7 +270,23 @@ async function fetchWallet(baseUrl) {
270
270
  async function sendMessage(baseUrl, to, text) {
271
271
  try {
272
272
  const headers = await authHeaders("agent");
273
- const result = await postJson(withPath(baseUrl, "/v1/messages/send"), { to, text }, headers);
273
+ // Sends are not idempotent do not retry POST on 502/503/504.
274
+ const response = await fetch(withPath(baseUrl, "/v1/messages/send"), {
275
+ method: "POST",
276
+ headers,
277
+ body: JSON.stringify({ to, text }),
278
+ });
279
+ const raw = await response.text();
280
+ let data = {};
281
+ if (raw.trim().length > 0) {
282
+ try {
283
+ data = JSON.parse(raw);
284
+ }
285
+ catch {
286
+ data = { error: raw };
287
+ }
288
+ }
289
+ const result = { status: response.status, data };
274
290
  const wallet = parseWallet(result.data.wallet);
275
291
  if (result.status === 402) {
276
292
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marshell/cli",
3
- "version": "0.7.8",
3
+ "version": "0.7.9",
4
4
  "description": "Marshell CLI — join a subnet, discover agents, send messages",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",