@vatio-ai/cli 0.122.0 → 0.123.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 +2 -11
- package/lib/commands/channels.mjs +1 -3
- package/lib/commands/chat.mjs +1 -1
- package/lib/commands/improve.mjs +10 -34
- package/lib/commands/messages.mjs +1 -1
- package/lib/commands/webhooks.mjs +9 -9
- package/lib/help.mjs +0 -5
- package/lib/suggest.mjs +5 -8
- package/lib/support.mjs +2 -4
- package/lib/telemetry.mjs +2 -5
- package/package.json +1 -1
package/bin/vatio.mjs
CHANGED
|
@@ -15,7 +15,7 @@ import { configCommand, doctor, init, version, whoami } from "../lib/commands/mi
|
|
|
15
15
|
import { diff, publish, pull, push, rollback, status } from "../lib/commands/deploy.mjs";
|
|
16
16
|
import { env } from "../lib/commands/env.mjs";
|
|
17
17
|
import { keys, secrets } from "../lib/commands/workspace-admin.mjs";
|
|
18
|
-
import {
|
|
18
|
+
import { webhooks } from "../lib/commands/webhooks.mjs";
|
|
19
19
|
import { contacts } from "../lib/commands/contacts.mjs";
|
|
20
20
|
import { auth } from "../lib/commands/identity-key.mjs";
|
|
21
21
|
import { chat, chatHelp } from "../lib/commands/chat.mjs";
|
|
@@ -25,8 +25,7 @@ import { quietHours } from "../lib/commands/quiet-hours.mjs";
|
|
|
25
25
|
import { team } from "../lib/commands/team.mjs";
|
|
26
26
|
import { instagram, whatsapp } from "../lib/commands/channels.mjs";
|
|
27
27
|
import { docs, feedback, shareSession } from "../lib/commands/support-commands.mjs";
|
|
28
|
-
import {
|
|
29
|
-
import { evalCommand, flags, test, tools } from "../lib/commands/improve.mjs";
|
|
28
|
+
import { test, tools } from "../lib/commands/improve.mjs";
|
|
30
29
|
import { printUpdateNotice, startUpdateCheck } from "../lib/update-notice.mjs";
|
|
31
30
|
import { runLatest } from "../lib/run-latest.mjs";
|
|
32
31
|
import { beginRun, isCodingAgent, reportRun, telemetryEnabled } from "../lib/telemetry.mjs";
|
|
@@ -98,8 +97,6 @@ async function run(command, args) {
|
|
|
98
97
|
return await diff(config, args);
|
|
99
98
|
case "keys":
|
|
100
99
|
return await keys(config, args);
|
|
101
|
-
case "templates":
|
|
102
|
-
return await templates(config, args);
|
|
103
100
|
case "webhooks":
|
|
104
101
|
return await webhooks(config, args);
|
|
105
102
|
case "contacts":
|
|
@@ -108,8 +105,6 @@ async function run(command, args) {
|
|
|
108
105
|
return await auth(config, args);
|
|
109
106
|
case "chat":
|
|
110
107
|
return await chat(config, args);
|
|
111
|
-
case "messages":
|
|
112
|
-
return await messages(config, args);
|
|
113
108
|
case "kb":
|
|
114
109
|
return await kb(config, args);
|
|
115
110
|
case "business":
|
|
@@ -124,12 +119,8 @@ async function run(command, args) {
|
|
|
124
119
|
return await whatsapp(config, args);
|
|
125
120
|
case "instagram":
|
|
126
121
|
return await instagram(config, args);
|
|
127
|
-
case "flags":
|
|
128
|
-
return await flags(config, args);
|
|
129
122
|
case "test":
|
|
130
123
|
return await test(config, args);
|
|
131
|
-
case "eval":
|
|
132
|
-
return await evalCommand(config, args);
|
|
133
124
|
case "tools":
|
|
134
125
|
return await tools(config, args);
|
|
135
126
|
case "changelog":
|
|
@@ -32,7 +32,6 @@ const MINE_REMOVED =
|
|
|
32
32
|
|
|
33
33
|
// One noun per thing on the inbox's WhatsApp page, each with the same verbs:
|
|
34
34
|
// the number itself, its test phones, its templates and its failed messages.
|
|
35
|
-
// `test-phones`, `vatio templates` and `vatio messages failed` still work.
|
|
36
35
|
export async function whatsapp(config, args = []) {
|
|
37
36
|
const json = takeFlag(args, "--json");
|
|
38
37
|
const sub = args.shift();
|
|
@@ -57,7 +56,6 @@ export async function whatsapp(config, args = []) {
|
|
|
57
56
|
case "team":
|
|
58
57
|
return printTeam(await client().whatsappTeam(), { json });
|
|
59
58
|
case "phones":
|
|
60
|
-
case "test-phones":
|
|
61
59
|
return phones(config, client(), args, { json });
|
|
62
60
|
case "templates":
|
|
63
61
|
return templates(config, json ? [...args, "--json"] : args);
|
|
@@ -189,7 +187,7 @@ function printNumber(number, { json = false } = {}) {
|
|
|
189
187
|
const live = number.live
|
|
190
188
|
? paint("green", "live: the agent answers everyone who writes")
|
|
191
189
|
: paint("cyan", "paused: vatio whatsapp live on to answer");
|
|
192
|
-
console.log(`\n${number.number ??
|
|
190
|
+
console.log(`\n${number.number ?? "Your number"}: ${live}`);
|
|
193
191
|
if (number.last_health_error) console.log(` ${paint("red", "problem:")} ${number.last_health_error} (vatio whatsapp check)`);
|
|
194
192
|
if (number.failed_deliveries) console.log(` ${number.failed_deliveries} failed deliveries: vatio whatsapp failed`);
|
|
195
193
|
}
|
package/lib/commands/chat.mjs
CHANGED
|
@@ -122,7 +122,7 @@ workspace has never met.
|
|
|
122
122
|
\`--as-phone\` opens a preview chat that speaks as a phone, for tools that
|
|
123
123
|
need $contact.phone_number or a team role (access: supervisor and up): \`me\`
|
|
124
124
|
is your own verified WhatsApp, with your role on the team; a number from
|
|
125
|
-
\`vatio whatsapp
|
|
125
|
+
\`vatio whatsapp phones\` is a customer. It stays a CLI chat: nothing goes
|
|
126
126
|
to WhatsApp.
|
|
127
127
|
|
|
128
128
|
\`export\` prints what people said and what they were answered between two
|
package/lib/commands/improve.mjs
CHANGED
|
@@ -63,18 +63,6 @@ async function fetchMarkdown(config, path, what) {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
// `vatio flags` until 0.120.0, when reports and tests became one list: kept
|
|
67
|
-
// for the skills, scripts and muscle memory that still call it.
|
|
68
|
-
export async function flags(config, args) {
|
|
69
|
-
const sub = args[0];
|
|
70
|
-
const removing = ["rm", "remove", "delete"].includes(sub);
|
|
71
|
-
const now = sub === "add" ? "vatio test add" : removing ? "vatio test rm" : "vatio test list";
|
|
72
|
-
console.error(`vatio: \`vatio flags${sub === "add" || removing ? ` ${sub}` : ""}\` is \`${now}\` now.`);
|
|
73
|
-
if (sub === "add") return await addTest(config, args.slice(1));
|
|
74
|
-
if (removing) return await removeTests(config, args.slice(1));
|
|
75
|
-
return await listTests(config, args);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
66
|
// Each tool's calls, error rate, timeouts and p50/p95 latency over a period,
|
|
79
67
|
// then the calls that failed with what your backend answered.
|
|
80
68
|
export async function tools(config, args) {
|
|
@@ -102,7 +90,7 @@ export async function test(config, args) {
|
|
|
102
90
|
if (args[0] === "add") return await addTest(config, args.slice(1));
|
|
103
91
|
if (args[0] === "list") return await listTests(config, args.slice(1));
|
|
104
92
|
if (["rm", "remove", "delete"].includes(args[0])) return await removeTests(config, args.slice(1));
|
|
105
|
-
return await runTests(config, args
|
|
93
|
+
return await runTests(config, args);
|
|
106
94
|
}
|
|
107
95
|
|
|
108
96
|
const TEST_ADD_USAGE =
|
|
@@ -219,25 +207,15 @@ async function removeTests(config, ids) {
|
|
|
219
207
|
}
|
|
220
208
|
}
|
|
221
209
|
|
|
222
|
-
|
|
223
|
-
// for the CI jobs and older skills that still call it; the name also reads as
|
|
224
|
-
// the shell's eval to command guards, which refused it.
|
|
225
|
-
export async function evalCommand(config, args) {
|
|
226
|
-
console.error("vatio: `vatio eval` is deprecated; use `vatio test --wait` (or `vatio test` to start the run and return).");
|
|
227
|
-
return await runTests(config, args, { name: "eval", waitByDefault: true });
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
async function runTests(config, args, { name, waitByDefault }) {
|
|
210
|
+
async function runTests(config, args) {
|
|
231
211
|
const show = takeValue(args, "--show");
|
|
232
212
|
if (show) return await testShow(config, show);
|
|
233
213
|
|
|
234
214
|
const environment = takeEnv(args, { fallback: "preview" });
|
|
235
215
|
const agent = takeValue(args, "--agent");
|
|
236
216
|
const wait = takeFlag(args, "--wait");
|
|
237
|
-
const noWait = takeFlag(args, "--no-wait");
|
|
238
217
|
const timeoutS = Number(takeValue(args, "--timeout") ?? DEFAULT_TIMEOUT_S);
|
|
239
218
|
const identity = takeIdentity(args, config);
|
|
240
|
-
const waiting = wait || (waitByDefault && !noWait);
|
|
241
219
|
|
|
242
220
|
const { url, token } = workspaceBase(config);
|
|
243
221
|
const client = new HttpClient({ baseUrl: url, token });
|
|
@@ -284,26 +262,24 @@ async function runTests(config, args, { name, waitByDefault }) {
|
|
|
284
262
|
const total = runs.reduce((sum, run) => sum + run.cases, 0);
|
|
285
263
|
console.error(`vatio: replaying ${total} case${total === 1 ? "" : "s"} on ${environment}…`);
|
|
286
264
|
await printSkillsHint();
|
|
287
|
-
if (!
|
|
288
|
-
for (const run of runs) console.log(`Run ${run.id} (${run.agent}): vatio
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
"
|
|
292
|
-
|
|
293
|
-
);
|
|
294
|
-
}
|
|
265
|
+
if (!wait) {
|
|
266
|
+
for (const run of runs) console.log(`Run ${run.id} (${run.agent}): vatio test --show ${run.id}`);
|
|
267
|
+
console.log(
|
|
268
|
+
"The runs keep going on Vatio's servers, five cases at a time. `vatio test --show RUN_ID` prints the\n" +
|
|
269
|
+
"report so far; `vatio test --wait` waits for this version's runs and exits 1 if a case fails."
|
|
270
|
+
);
|
|
295
271
|
return;
|
|
296
272
|
}
|
|
297
273
|
// Said before waiting, so the id is there to read the run again later
|
|
298
274
|
// however this command ends.
|
|
299
|
-
for (const run of runs) console.error(`vatio: run ${run.id} (${run.agent}): vatio
|
|
275
|
+
for (const run of runs) console.error(`vatio: run ${run.id} (${run.agent}): vatio test --show ${run.id}`);
|
|
300
276
|
|
|
301
277
|
const deadline = Date.now() + timeoutS * 1000;
|
|
302
278
|
const finished = [];
|
|
303
279
|
for (const run of runs) {
|
|
304
280
|
let row = run;
|
|
305
281
|
while (!row.finished) {
|
|
306
|
-
if (Date.now() > deadline) fail(`Timed out after ${timeoutS}s; the run keeps going. See it with: vatio
|
|
282
|
+
if (Date.now() > deadline) fail(`Timed out after ${timeoutS}s; the run keeps going. See it with: vatio test --show ${run.id}`);
|
|
307
283
|
await sleep(POLL_MS);
|
|
308
284
|
row = await client.get(`/evals/runs/${run.id}`);
|
|
309
285
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { deployClient } from "./deploy.mjs";
|
|
4
4
|
import { fail, takeEnv, takeFlag, takeValue } from "../support.mjs";
|
|
5
5
|
|
|
6
|
-
const USAGE = "vatio
|
|
6
|
+
const USAGE = "vatio whatsapp failed [--since DATE] [--until DATE] [--error-code CODE] " +
|
|
7
7
|
"[--error-contains TEXT] [--before ID] [--json]";
|
|
8
8
|
|
|
9
9
|
export async function messages(config, args) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// `vatio templates` / `vatio webhooks` — what a developer sets up so their
|
|
1
|
+
// `vatio whatsapp templates` / `vatio webhooks` — what a developer sets up so their
|
|
2
2
|
// backend can send WhatsApp messages through the server API: the templates
|
|
3
3
|
// the number can send and new ones for Meta to approve, and where Vatio
|
|
4
4
|
// reports what happened. Sending itself is the backend's job, with a server
|
|
@@ -16,11 +16,11 @@ function takeAll(args, name) {
|
|
|
16
16
|
return values;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
const LIST_USAGE = "vatio templates list [--env live] [--json]";
|
|
20
|
-
const CREATE_USAGE = "vatio templates create NAME --language CODE --body TEXT [--example VALUE]... " +
|
|
19
|
+
const LIST_USAGE = "vatio whatsapp templates list [--env live] [--json]";
|
|
20
|
+
const CREATE_USAGE = "vatio whatsapp templates create NAME --language CODE --body TEXT [--example VALUE]... " +
|
|
21
21
|
"[--category utility|marketing] [--footer TEXT] [--json]";
|
|
22
|
-
const RM_USAGE = "vatio templates rm NAME [--language CODE] [--json]";
|
|
23
|
-
const SYNC_USAGE = "vatio templates sync [--json]";
|
|
22
|
+
const RM_USAGE = "vatio whatsapp templates rm NAME [--language CODE] [--json]";
|
|
23
|
+
const SYNC_USAGE = "vatio whatsapp templates sync [--json]";
|
|
24
24
|
|
|
25
25
|
export async function templates(config, args) {
|
|
26
26
|
const json = takeFlag(args, "--json");
|
|
@@ -53,12 +53,12 @@ export async function templates(config, args) {
|
|
|
53
53
|
if (list.length === 0) {
|
|
54
54
|
if (live && payload.whatsapp_connected === false) {
|
|
55
55
|
console.log("This workspace has no WhatsApp number of its own yet. The templates you create stay on Vatio's " +
|
|
56
|
-
"test number until you connect one, and then Vatio moves them to it: vatio templates list --env preview");
|
|
56
|
+
"test number until you connect one, and then Vatio moves them to it: vatio whatsapp templates list --env preview");
|
|
57
57
|
} else if (!live && payload.whatsapp_connected === true) {
|
|
58
|
-
console.log("This workspace has its own WhatsApp number, so its templates are there: vatio templates list");
|
|
58
|
+
console.log("This workspace has its own WhatsApp number, so its templates are there: vatio whatsapp templates list");
|
|
59
59
|
} else {
|
|
60
60
|
console.log(`No templates on ${live ? "this workspace's WhatsApp number" : "Vatio's test number for this workspace"} yet. Create one:`);
|
|
61
|
-
console.log(' vatio templates create order_shipped --language es --body "Hi {{1}}, order {{2}} is on its way." ' +
|
|
61
|
+
console.log(' vatio whatsapp templates create order_shipped --language es --body "Hi {{1}}, order {{2}} is on its way." ' +
|
|
62
62
|
'--example Ana --example "#1042"');
|
|
63
63
|
}
|
|
64
64
|
return;
|
|
@@ -100,7 +100,7 @@ async function createTemplate(config, args, json) {
|
|
|
100
100
|
console.log(`Submitted ${template.name} (${template.language}) for Meta's review on ` +
|
|
101
101
|
`${own ? "your own number" : "Vatio's test number"}: ${template.category}, ` +
|
|
102
102
|
`${count} param${count === 1 ? "" : "s"}, ${paint("cyan", template.status)}.`);
|
|
103
|
-
console.log("Meta usually decides within minutes, at most 24 hours. Check with: vatio templates list" +
|
|
103
|
+
console.log("Meta usually decides within minutes, at most 24 hours. Check with: vatio whatsapp templates list" +
|
|
104
104
|
(own ? "" : " --env preview"));
|
|
105
105
|
console.log(own
|
|
106
106
|
? "Once APPROVED, your backend sends it with a live key outside the 24-hour window with:"
|
package/lib/help.mjs
CHANGED
|
@@ -115,9 +115,6 @@ the two you are in. Commands default as listed.
|
|
|
115
115
|
and what each tool answered, tests that fail or
|
|
116
116
|
answer differently each time; then every test
|
|
117
117
|
test rm ID [ID...] Remove a test, or a report (F-) and its test
|
|
118
|
-
eval Deprecated: \`vatio test --wait\` under its old name
|
|
119
|
-
flags [add|rm] Deprecated: \`vatio test list\`, \`test add\` and
|
|
120
|
-
\`test rm\` under their old name
|
|
121
118
|
|
|
122
119
|
Knowledge:
|
|
123
120
|
kb [list] Bases, and whether a deployed agent reads each
|
|
@@ -218,8 +215,6 @@ the two you are in. Commands default as listed.
|
|
|
218
215
|
whatsapp failed [--since DATE] [--until DATE] [--error-code CODE]
|
|
219
216
|
[--error-contains TEXT] [--before ID]
|
|
220
217
|
Messages Vatio gave up retrying (default: live)
|
|
221
|
-
templates ... Older spelling of whatsapp templates; still works
|
|
222
|
-
messages failed ... Older spelling of whatsapp failed; still works
|
|
223
218
|
|
|
224
219
|
Channels:
|
|
225
220
|
instagram The same, for Instagram
|
package/lib/suggest.mjs
CHANGED
|
@@ -35,16 +35,13 @@ export const COMMANDS = [
|
|
|
35
35
|
"docs",
|
|
36
36
|
"doctor",
|
|
37
37
|
"env",
|
|
38
|
-
"eval",
|
|
39
38
|
"feedback",
|
|
40
|
-
"flags",
|
|
41
39
|
"init",
|
|
42
40
|
"instagram",
|
|
43
41
|
"kb",
|
|
44
42
|
"keys",
|
|
45
43
|
"login",
|
|
46
44
|
"logout",
|
|
47
|
-
"messages",
|
|
48
45
|
"publish",
|
|
49
46
|
"pull",
|
|
50
47
|
"push",
|
|
@@ -54,7 +51,6 @@ export const COMMANDS = [
|
|
|
54
51
|
"share-session",
|
|
55
52
|
"status",
|
|
56
53
|
"team",
|
|
57
|
-
"templates",
|
|
58
54
|
"test",
|
|
59
55
|
"tools",
|
|
60
56
|
"version",
|
|
@@ -74,17 +70,17 @@ export const COMMANDS = [
|
|
|
74
70
|
const SUBCOMMAND_OF = {
|
|
75
71
|
add: ["test"],
|
|
76
72
|
cat: ["kb"],
|
|
77
|
-
create: ["kb", "keys", "
|
|
73
|
+
create: ["kb", "keys", "webhooks"],
|
|
78
74
|
delete: ["contacts"],
|
|
79
75
|
deliveries: ["webhooks"],
|
|
80
76
|
enable: ["webhooks"],
|
|
81
77
|
export: ["chat", "contacts"],
|
|
82
|
-
failed: ["
|
|
78
|
+
failed: ["whatsapp"],
|
|
83
79
|
follow: ["kb"],
|
|
84
80
|
get: ["config"],
|
|
85
81
|
history: ["kb"],
|
|
86
82
|
invite: ["team"],
|
|
87
|
-
list: ["env", "kb", "secrets", "keys", "team", "
|
|
83
|
+
list: ["env", "kb", "secrets", "keys", "team", "webhooks", "test"],
|
|
88
84
|
off: ["quiet-hours"],
|
|
89
85
|
origins: ["keys"],
|
|
90
86
|
refresh: ["kb"],
|
|
@@ -94,7 +90,8 @@ const SUBCOMMAND_OF = {
|
|
|
94
90
|
"rm-entry": ["kb"],
|
|
95
91
|
set: ["business", "quiet-hours", "secrets", "config"],
|
|
96
92
|
show: ["chat", "kb", "business", "quiet-hours", "config"],
|
|
97
|
-
|
|
93
|
+
phones: ["whatsapp"],
|
|
94
|
+
templates: ["whatsapp"],
|
|
98
95
|
unfollow: ["kb"],
|
|
99
96
|
unset: ["config"],
|
|
100
97
|
write: ["kb"]
|
package/lib/support.mjs
CHANGED
|
@@ -20,16 +20,14 @@ export function fail(message) {
|
|
|
20
20
|
// preview or live. The platform validates the name.
|
|
21
21
|
//
|
|
22
22
|
// Without it, the default is the command's own and is passed in, because the
|
|
23
|
-
// sensible answer differs: push writes preview, keys are for live.
|
|
24
|
-
// was the spelling on push and publish and stays as an alias -- it is sitting
|
|
25
|
-
// in CI jobs, and there is nothing wrong with what it does.
|
|
23
|
+
// sensible answer differs: push writes preview, keys are for live.
|
|
26
24
|
export function takeEnv(args, { fallback = null } = {}) {
|
|
27
25
|
let environment;
|
|
28
26
|
const rest = [];
|
|
29
27
|
|
|
30
28
|
for (let i = 0; i < args.length; i += 1) {
|
|
31
29
|
const arg = args[i];
|
|
32
|
-
const match = /^--(env
|
|
30
|
+
const match = /^--(env)(?:=(.*))?$/.exec(arg);
|
|
33
31
|
if (!match) {
|
|
34
32
|
rest.push(arg);
|
|
35
33
|
continue;
|
package/lib/telemetry.mjs
CHANGED
|
@@ -30,21 +30,18 @@ const MAX_MESSAGE = 2_000;
|
|
|
30
30
|
// there is a value (`vatio chat "hola"`), and values are not sent.
|
|
31
31
|
const SUBCOMMANDS = {
|
|
32
32
|
chat: ["show"],
|
|
33
|
-
messages: ["failed"],
|
|
34
33
|
env: ["list", "rm"],
|
|
35
34
|
kb: ["list", "show", "create", "rm", "write", "cat", "rm-entry", "status", "publish", "history"],
|
|
36
35
|
business: ["show", "set"],
|
|
37
36
|
"quiet-hours": ["show", "set", "off"],
|
|
38
37
|
secrets: ["list", "set", "rm"],
|
|
39
38
|
keys: ["list", "create", "origins", "revoke"],
|
|
40
|
-
templates: ["list", "create"],
|
|
41
39
|
webhooks: ["list", "create", "test", "deliveries", "enable", "rm"],
|
|
42
40
|
contacts: ["export", "delete"],
|
|
43
|
-
whatsapp: ["
|
|
41
|
+
whatsapp: ["status", "connect", "live", "check", "disconnect", "invite", "team", "phones", "templates", "failed"],
|
|
44
42
|
config: ["show", "get", "set", "unset"],
|
|
45
43
|
"share-session": ["--should-ask", "--never"],
|
|
46
|
-
test: ["add", "list", "rm"]
|
|
47
|
-
flags: ["add", "rm"]
|
|
44
|
+
test: ["add", "list", "rm"]
|
|
48
45
|
};
|
|
49
46
|
|
|
50
47
|
export const USER_AGENT = `vatio-cli/${VERSION} (node ${process.version}; ${platform()} ${arch()})`;
|