@vatio-ai/cli 0.93.0 → 0.95.0
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/bin/vatio.mjs +3 -0
- package/lib/api-client.mjs +8 -0
- package/lib/commands/messages.mjs +31 -0
- package/lib/help.mjs +7 -0
- package/lib/telemetry.mjs +1 -0
- package/package.json +1 -1
package/bin/vatio.mjs
CHANGED
|
@@ -21,6 +21,7 @@ import { kb } from "../lib/commands/knowledge.mjs";
|
|
|
21
21
|
import { business } from "../lib/commands/business.mjs";
|
|
22
22
|
import { instagram, whatsapp } from "../lib/commands/channels.mjs";
|
|
23
23
|
import { docs, feedback, shareSession } from "../lib/commands/support-commands.mjs";
|
|
24
|
+
import { messages } from "../lib/commands/messages.mjs";
|
|
24
25
|
import { evalCommand, flags, test, tools } from "../lib/commands/improve.mjs";
|
|
25
26
|
import { printUpdateNotice, startUpdateCheck } from "../lib/update-notice.mjs";
|
|
26
27
|
import { runLatest } from "../lib/run-latest.mjs";
|
|
@@ -104,6 +105,8 @@ async function run(command, args) {
|
|
|
104
105
|
return await auth(config, args);
|
|
105
106
|
case "chat":
|
|
106
107
|
return await chat(config, args);
|
|
108
|
+
case "messages":
|
|
109
|
+
return await messages(config, args);
|
|
107
110
|
case "kb":
|
|
108
111
|
return await kb(config, args);
|
|
109
112
|
case "business":
|
package/lib/api-client.mjs
CHANGED
|
@@ -9,6 +9,14 @@ import { HttpClient } from "./http.mjs";
|
|
|
9
9
|
const encode = (value) => encodeURIComponent(String(value));
|
|
10
10
|
|
|
11
11
|
export class ApiClient extends HttpClient {
|
|
12
|
+
// --- outbound WhatsApp messages ------------------------------------
|
|
13
|
+
|
|
14
|
+
failedMessages({ environment = "live", since = null, until = null, errorCode = null, errorContains = null, before = null } = {}) {
|
|
15
|
+
return this.get("/messages", {
|
|
16
|
+
environment, since, until, error_code: errorCode, error_contains: errorContains, before
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
12
20
|
// --- deploy ---------------------------------------------------------
|
|
13
21
|
|
|
14
22
|
deployStatus() {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Review terminal failures after Vatio has finished its automatic attempts.
|
|
2
|
+
|
|
3
|
+
import { deployClient } from "./deploy.mjs";
|
|
4
|
+
import { fail, takeEnv, takeFlag, takeValue } from "../support.mjs";
|
|
5
|
+
|
|
6
|
+
const USAGE = "vatio messages failed [--since DATE] [--until DATE] [--error-code CODE] " +
|
|
7
|
+
"[--error-contains TEXT] [--before ID] [--json]";
|
|
8
|
+
|
|
9
|
+
export async function messages(config, args) {
|
|
10
|
+
const environment = takeEnv(args, { fallback: "live" });
|
|
11
|
+
const json = takeFlag(args, "--json");
|
|
12
|
+
const since = takeValue(args, "--since");
|
|
13
|
+
const until = takeValue(args, "--until");
|
|
14
|
+
const errorCode = takeValue(args, "--error-code");
|
|
15
|
+
const errorContains = takeValue(args, "--error-contains");
|
|
16
|
+
const before = takeValue(args, "--before");
|
|
17
|
+
const sub = args.shift() ?? "failed";
|
|
18
|
+
if (sub !== "failed" || args.length > 0) fail(`Usage: ${USAGE}`);
|
|
19
|
+
if (before !== null && !/^[1-9]\d*$/.test(before)) fail("--before needs a positive message ID");
|
|
20
|
+
|
|
21
|
+
const workspace = config.resolveWorkspaceRequired();
|
|
22
|
+
const client = deployClient(config, workspace);
|
|
23
|
+
const page = await client.failedMessages({ environment, since, until, errorCode, errorContains, before });
|
|
24
|
+
if (json) return console.log(JSON.stringify(page, null, 2));
|
|
25
|
+
|
|
26
|
+
console.log(`${page.messages.length} failed messages on ${workspace} (${environment}):`);
|
|
27
|
+
for (const row of page.messages) {
|
|
28
|
+
console.log(` #${row.id} ${row.created_at} ${row.mode} ${row.error_code || "?"} ${row.error_message || ""}`);
|
|
29
|
+
}
|
|
30
|
+
if (page.next_before) console.log(`More may match. Continue with --before ${page.next_before}.`);
|
|
31
|
+
}
|
package/lib/help.mjs
CHANGED
|
@@ -144,6 +144,13 @@ Commands default as listed.
|
|
|
144
144
|
Your users sign in with Supabase: verify their
|
|
145
145
|
session, no keys or signing code
|
|
146
146
|
|
|
147
|
+
Recover outbound WhatsApp messages (with your developer login):
|
|
148
|
+
Vatio retries confirmed failures automatically. Inspect terminal failures:
|
|
149
|
+
messages failed [--since DATE] [--until DATE] [--error-code CODE]
|
|
150
|
+
[--error-contains TEXT] [--before ID] [--json]
|
|
151
|
+
List failed outgoing messages, including Meta's
|
|
152
|
+
delivery failures (default: live)
|
|
153
|
+
|
|
147
154
|
Sending from your backend (WhatsApp, with a server key):
|
|
148
155
|
templates list [--env live] [--json]
|
|
149
156
|
The number's templates, parameter counts, and the
|
package/lib/telemetry.mjs
CHANGED
|
@@ -26,6 +26,7 @@ const MAX_MESSAGE = 2_000;
|
|
|
26
26
|
// there is a value (`vatio chat "hola"`), and values are not sent.
|
|
27
27
|
const SUBCOMMANDS = {
|
|
28
28
|
chat: ["show"],
|
|
29
|
+
messages: ["failed"],
|
|
29
30
|
env: ["list", "rm"],
|
|
30
31
|
kb: ["list", "show", "create", "rm", "write", "cat", "rm-entry", "status", "publish", "history"],
|
|
31
32
|
business: ["show", "set"],
|