@deckasoft/waify 0.4.1 → 0.4.2
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/cli/index.js +24 -12
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -888,7 +888,8 @@ var init_start = __esm({
|
|
|
888
888
|
});
|
|
889
889
|
|
|
890
890
|
// src/cli/index.ts
|
|
891
|
-
|
|
891
|
+
init_paths();
|
|
892
|
+
import { config as dotenvConfig } from "dotenv";
|
|
892
893
|
import { Command } from "commander";
|
|
893
894
|
|
|
894
895
|
// src/cli/commands/init.ts
|
|
@@ -1300,18 +1301,28 @@ var registerSetup = (program2) => {
|
|
|
1300
1301
|
{ encoding: "utf-8" }
|
|
1301
1302
|
);
|
|
1302
1303
|
console.warn("Starting WhatsApp engine...");
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
if (!startRes.ok && startRes.status !== 400) {
|
|
1312
|
-
throw new Error(
|
|
1313
|
-
`Failed to start session: ${startRes.status} ${startRes.statusText}`
|
|
1304
|
+
try {
|
|
1305
|
+
const startRes = await fetchWithTimeout(
|
|
1306
|
+
`${baseUrl}/api/sessions/${sessionId}/start`,
|
|
1307
|
+
{
|
|
1308
|
+
method: "POST",
|
|
1309
|
+
headers: { "X-API-Key": openwaApiKey }
|
|
1310
|
+
},
|
|
1311
|
+
3e4
|
|
1314
1312
|
);
|
|
1313
|
+
if (!startRes.ok && startRes.status !== 400) {
|
|
1314
|
+
throw new Error(
|
|
1315
|
+
`Failed to start session: ${startRes.status} ${startRes.statusText}`
|
|
1316
|
+
);
|
|
1317
|
+
}
|
|
1318
|
+
} catch (err) {
|
|
1319
|
+
if (err instanceof Error && err.name === "TimeoutError") {
|
|
1320
|
+
console.warn(
|
|
1321
|
+
" (Engine start is taking longer than expected \u2014 Chromium may still be loading, continuing\u2026)"
|
|
1322
|
+
);
|
|
1323
|
+
} else {
|
|
1324
|
+
throw err;
|
|
1325
|
+
}
|
|
1315
1326
|
}
|
|
1316
1327
|
try {
|
|
1317
1328
|
const preStatusRes = await fetchWithTimeout(
|
|
@@ -1640,6 +1651,7 @@ var registerTui = (program2) => {
|
|
|
1640
1651
|
};
|
|
1641
1652
|
|
|
1642
1653
|
// src/cli/index.ts
|
|
1654
|
+
dotenvConfig({ path: envPath() });
|
|
1643
1655
|
var program = new Command();
|
|
1644
1656
|
program.name("waify").description("AI-powered daily message sender for WhatsApp").version("0.1.0");
|
|
1645
1657
|
registerInit(program);
|