@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.
- package/dist/network.js +18 -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.
|
|
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
|
-
|
|
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 {
|