@vatio-ai/cli 0.132.0 → 0.134.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 +28 -3
- package/lib/api-client.mjs +31 -6
- package/lib/bundle.mjs +1 -1
- package/lib/commands/auth.mjs +1 -1
- package/lib/commands/channels.mjs +14 -3
- package/lib/commands/chat.mjs +55 -53
- package/lib/commands/deploy.mjs +1 -1
- package/lib/commands/improve.mjs +22 -35
- package/lib/commands/messages.mjs +3 -3
- package/lib/commands/owner.mjs +159 -0
- package/lib/commands/reach.mjs +104 -0
- package/lib/commands/support-commands.mjs +1 -1
- package/lib/commands/team.mjs +43 -6
- package/lib/commands/webhooks.mjs +13 -13
- package/lib/commands/workspace-admin.mjs +11 -9
- package/lib/config.mjs +1 -1
- package/lib/device-auth.mjs +3 -3
- package/lib/help.mjs +50 -11
- package/lib/http.mjs +12 -3
- package/lib/suggest.mjs +10 -1
- package/lib/support.mjs +9 -0
- package/lib/telemetry.mjs +10 -3
- package/lib/workspace.mjs +1 -1
- package/package.json +1 -1
package/lib/help.mjs
CHANGED
|
@@ -91,18 +91,28 @@ it made obsolete, moves it on. \`vatio rollback\` undoes the last change.
|
|
|
91
91
|
The chat you are in, or any chat in the workspace
|
|
92
92
|
(web, WhatsApp, ...): messages, tool calls, channel,
|
|
93
93
|
and what was read of each file (truncated, unreadable)
|
|
94
|
-
chat export --from DATE [--to DATE] [--
|
|
94
|
+
chat export --from DATE [--to DATE] [--team] [--channel NAME] [--out FILE]
|
|
95
95
|
What people said and were answered between two
|
|
96
96
|
dates, redacted by Vatio, one conversation per
|
|
97
|
-
line as JSON
|
|
97
|
+
line as JSON: your customers', or your team's own
|
|
98
|
+
with --team. Any team member,
|
|
98
99
|
viewers included; every call is in the activity
|
|
100
|
+
chat reply CHAT_ID "TEXT" Write in a customer's conversation as a person on the
|
|
101
|
+
team: the agent stays out of it until
|
|
102
|
+
chat release CHAT_ID hands it back to the agent
|
|
103
|
+
analytics [--days N] The inbox's Analytics: conversations, messages, replies
|
|
104
|
+
Vatio saved, after hours, questions to the team
|
|
105
|
+
testers [web|whatsapp|instagram] | rm whatsapp|instagram ID
|
|
106
|
+
Who reaches your team's version on Vatio's shared
|
|
107
|
+
number and account
|
|
99
108
|
|
|
100
109
|
Test and improve it: what it should do, what supervisors reported, and how
|
|
101
110
|
its tools answered (test add, test list, fix, push, test):
|
|
102
|
-
tools [--
|
|
111
|
+
tools [--period 1h|1d|7d|30d] [--json]
|
|
103
112
|
Each tool's calls, error rate, timeouts and
|
|
104
113
|
p50/p95, then the calls that failed with what
|
|
105
|
-
your backend answered
|
|
114
|
+
your backend answered, in your customers'
|
|
115
|
+
conversations. Default: 7d
|
|
106
116
|
test [--agent SLUG] [--as-subject ID | --visitor-token JWT]
|
|
107
117
|
Test every report and test against your team's
|
|
108
118
|
version: starts the runs on Vatio's servers,
|
|
@@ -154,13 +164,37 @@ it made obsolete, moves it on. \`vatio rollback\` undoes the last change.
|
|
|
154
164
|
Replace the schedule. DAYS: mon, mon-fri, sat,sun, all
|
|
155
165
|
A range may cross midnight: "fri 22:00-08:00"
|
|
156
166
|
quiet-hours off Answer around the clock
|
|
167
|
+
widget [show] The web widget's look and greeting, and its snippet
|
|
168
|
+
widget set [--title T] [--greeting G] [--suggestion S]... [--position left|right]
|
|
169
|
+
[--scheme auto|light|dark] [--reply-style stream|paced] [--locale en|es|pt]
|
|
157
170
|
|
|
158
171
|
Team (the owner's; the same roles as the inbox's Team page):
|
|
159
172
|
team [list] [--json] The owner and everyone invited, and who has not signed in yet
|
|
160
173
|
team invite EMAIL --role viewer|supervisor|developer [--code CODE]
|
|
161
174
|
Invite them and email them. Needs a second factor on your
|
|
162
|
-
account: --code is your authenticator app's code
|
|
163
|
-
|
|
175
|
+
account: --code is your authenticator app's code
|
|
176
|
+
team role EMAIL viewer|supervisor|developer [--code CODE]
|
|
177
|
+
Change what they reach; the same second factor
|
|
178
|
+
team rm EMAIL Take their access away
|
|
179
|
+
team resend EMAIL Email the invitation again
|
|
180
|
+
team questions [--to EMAIL...|--none] [--template NAME [--language CODE]|--no-template]
|
|
181
|
+
Who the agent asks when it cannot answer a customer
|
|
182
|
+
|
|
183
|
+
The workspace (the owner's, as the inbox's Security, Activity and Plan pages):
|
|
184
|
+
security [show] Whether everyone needs two-step verification, and how long
|
|
185
|
+
conversations are kept
|
|
186
|
+
security set [--require-2fa on|off] [--retention-days N]
|
|
187
|
+
activity [--category NAME] [--page N]
|
|
188
|
+
Who did what in the workspace, newest first
|
|
189
|
+
support-access [show] Whether Vatio staff can open the workspace now
|
|
190
|
+
support-access open 24h|72h|7d | close
|
|
191
|
+
transfer [show] Handing the workspace to someone else
|
|
192
|
+
transfer offer EMAIL [--code CODE] | cancel
|
|
193
|
+
transfer accept SLUG [--code CODE] | decline SLUG
|
|
194
|
+
A workspace someone offered to you
|
|
195
|
+
workspace delete SLUG [--yes] [--code CODE]
|
|
196
|
+
Delete it for everyone; it cannot be undone
|
|
197
|
+
plan The plan and this period's conversations against it
|
|
164
198
|
|
|
165
199
|
Credentials:
|
|
166
200
|
secrets list|set KEY [VALUE] [--from-env [NAME]]|rm KEY [--tests]
|
|
@@ -176,6 +210,9 @@ it made obsolete, moves it on. \`vatio rollback\` undoes the last change.
|
|
|
176
210
|
backend, with its scopes)
|
|
177
211
|
keys create publishable|secret [--label NAME] [--json]
|
|
178
212
|
A publishable key works from any site
|
|
213
|
+
keys create secret --test A secret key that reaches only your team and the
|
|
214
|
+
customer phones you added, through Vatio's test
|
|
215
|
+
number: for your backend's development and staging
|
|
179
216
|
keys create secret --scope NAME... [--code CODE | --recovery-code CODE]
|
|
180
217
|
What the secret key may call: messages, instagram,
|
|
181
218
|
chats, team (repeatable). Without --scope, all but
|
|
@@ -185,7 +222,7 @@ it made obsolete, moves it on. \`vatio rollback\` undoes the last change.
|
|
|
185
222
|
auth --new-key Keypair that signs the JWT saying who a visitor is
|
|
186
223
|
|
|
187
224
|
Sending from your backend (with a server key):
|
|
188
|
-
webhooks list|create URL [--event NAME]
|
|
225
|
+
webhooks list|create URL [--event NAME]... [--test]|test ID|deliveries ID|enable ID|rm ID
|
|
189
226
|
Where Vatio tells your backend what happened
|
|
190
227
|
|
|
191
228
|
Contacts (privacy requests on one person; the ID is the contact's number in the inbox):
|
|
@@ -213,8 +250,9 @@ it made obsolete, moves it on. \`vatio rollback\` undoes the last change.
|
|
|
213
250
|
whatsapp team The team and each person's own WhatsApp: the
|
|
214
251
|
phone the agent knows them by, and that reaches
|
|
215
252
|
it on Vatio's number
|
|
216
|
-
whatsapp templates [list] [--
|
|
217
|
-
The number's templates and the "template" to send
|
|
253
|
+
whatsapp templates [list] [--test-number]
|
|
254
|
+
The number's templates and the "template" to send;
|
|
255
|
+
--test-number lists those on Vatio's test number
|
|
218
256
|
whatsapp templates create NAME --language CODE --body TEXT [--example VALUE]...
|
|
219
257
|
[--category utility|marketing] [--footer TEXT]
|
|
220
258
|
[--button-url 'TEXT|URL']... [--button-example VALUE]...
|
|
@@ -226,10 +264,11 @@ it made obsolete, moves it on. \`vatio rollback\` undoes the last change.
|
|
|
226
264
|
on Vatio's test number until you connect one
|
|
227
265
|
whatsapp templates rm NAME [--language CODE] | sync
|
|
228
266
|
Delete one at Meta; pull back ones made elsewhere
|
|
229
|
-
whatsapp failed [--since DATE] [--until DATE] [--error-code CODE]
|
|
267
|
+
whatsapp failed [--test] [--since DATE] [--until DATE] [--error-code CODE]
|
|
230
268
|
[--error-contains TEXT] [--before ID]
|
|
231
269
|
Messages Vatio gave up retrying, with your
|
|
232
|
-
external_ref
|
|
270
|
+
external_ref; --test for what your test secret
|
|
271
|
+
key sent
|
|
233
272
|
|
|
234
273
|
Channels:
|
|
235
274
|
instagram The same, for Instagram
|
package/lib/http.mjs
CHANGED
|
@@ -71,10 +71,11 @@ function unprocessableMessage(body) {
|
|
|
71
71
|
.map((entry) => (typeof entry === "object" ? String(entry.message ?? "") : String(entry)));
|
|
72
72
|
if (errors.length > 0) return errors.join("; ");
|
|
73
73
|
|
|
74
|
-
// `{ error
|
|
75
|
-
//
|
|
74
|
+
// `{ error, error_description }` is how the API the MCP and the inbox share
|
|
75
|
+
// says it; `{ error: { code, message } }` how the knowledge and token
|
|
76
|
+
// endpoints do.
|
|
76
77
|
const error = body.error && typeof body.error === "object" && !Array.isArray(body.error) ? body.error.message : body.error;
|
|
77
|
-
const message = body.error_message ?? error;
|
|
78
|
+
const message = body.error_description ?? body.error_message ?? error;
|
|
78
79
|
if (message != null) return Array.isArray(message) ? message.join("; ") : String(message);
|
|
79
80
|
|
|
80
81
|
return "Unprocessable";
|
|
@@ -192,3 +193,11 @@ function responseMessage(body, raw, response) {
|
|
|
192
193
|
if (text === "" || text.startsWith("<")) return response.statusText || `HTTP ${response.status}`;
|
|
193
194
|
return text.slice(0, 200);
|
|
194
195
|
}
|
|
196
|
+
|
|
197
|
+
// The code a refusal carries, whichever way the platform wrote it: `error`
|
|
198
|
+
// as a string (the API the MCP and the inbox share), `error: { code }` or
|
|
199
|
+
// `error_key`.
|
|
200
|
+
export function errorCode(error) {
|
|
201
|
+
const body = error?.body ?? {};
|
|
202
|
+
return body.error_key ?? (typeof body.error === "string" ? body.error : body.error?.code) ?? null;
|
|
203
|
+
}
|
package/lib/suggest.mjs
CHANGED
|
@@ -56,7 +56,16 @@ export const COMMANDS = [
|
|
|
56
56
|
"version",
|
|
57
57
|
"webhooks",
|
|
58
58
|
"whatsapp",
|
|
59
|
-
"whoami"
|
|
59
|
+
"whoami",
|
|
60
|
+
"activity",
|
|
61
|
+
"analytics",
|
|
62
|
+
"plan",
|
|
63
|
+
"security",
|
|
64
|
+
"support-access",
|
|
65
|
+
"testers",
|
|
66
|
+
"transfer",
|
|
67
|
+
"widget",
|
|
68
|
+
"workspace"
|
|
60
69
|
];
|
|
61
70
|
|
|
62
71
|
// Words that only mean something after a command. A token that is one of
|
package/lib/support.mjs
CHANGED
|
@@ -47,6 +47,15 @@ export function takeEnv(args, { fallback = null } = {}) {
|
|
|
47
47
|
return environment !== undefined ? environment : fallback;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
// The side a command reads or acts on, said plainly: `flag` (--team, --test,
|
|
51
|
+
// --test-number) names the team's or the test side, which the platform still
|
|
52
|
+
// calls preview. `--env NAME` from before still works.
|
|
53
|
+
export function takeSide(args, flag, { fallback = "live" } = {}) {
|
|
54
|
+
const environment = takeEnv(args, { fallback: null });
|
|
55
|
+
const flagged = takeFlag(args, flag);
|
|
56
|
+
return environment ?? (flagged ? "preview" : fallback);
|
|
57
|
+
}
|
|
58
|
+
|
|
50
59
|
export function takeFlag(args, name) {
|
|
51
60
|
const index = args.indexOf(name);
|
|
52
61
|
if (index === -1) return false;
|
package/lib/telemetry.mjs
CHANGED
|
@@ -29,7 +29,7 @@ const MAX_MESSAGE = 2_000;
|
|
|
29
29
|
// Only words a command takes as its first argument are kept: anything else
|
|
30
30
|
// there is a value (`vatio chat "hola"`), and values are not sent.
|
|
31
31
|
const SUBCOMMANDS = {
|
|
32
|
-
chat: ["show"],
|
|
32
|
+
chat: ["show", "export", "reply", "release"],
|
|
33
33
|
env: ["list", "rm"],
|
|
34
34
|
kb: ["list", "show", "create", "rm", "write", "cat", "rm-entry", "status", "publish", "history"],
|
|
35
35
|
business: ["show", "set"],
|
|
@@ -41,7 +41,14 @@ const SUBCOMMANDS = {
|
|
|
41
41
|
whatsapp: ["status", "connect", "live", "check", "disconnect", "invite", "team", "templates", "failed"],
|
|
42
42
|
config: ["show", "get", "set", "unset"],
|
|
43
43
|
"share-session": ["--should-ask", "--never"],
|
|
44
|
-
test: ["add", "list", "rm"]
|
|
44
|
+
test: ["add", "list", "rm"],
|
|
45
|
+
team: ["list", "invite", "role", "rm", "resend", "questions"],
|
|
46
|
+
widget: ["show", "set"],
|
|
47
|
+
security: ["show", "set"],
|
|
48
|
+
"support-access": ["show", "open", "close"],
|
|
49
|
+
transfer: ["show", "offer", "cancel", "accept", "decline"],
|
|
50
|
+
workspace: ["delete"],
|
|
51
|
+
testers: ["web", "whatsapp", "instagram", "rm"]
|
|
45
52
|
};
|
|
46
53
|
|
|
47
54
|
export const USER_AGENT = `vatio-cli/${VERSION} (node ${process.version}; ${platform()} ${arch()})`;
|
|
@@ -201,7 +208,7 @@ async function post(config, body, { strict = false } = {}) {
|
|
|
201
208
|
const headers = { ...(strict ? chosenHeaders() : clientHeaders()), "Content-Type": "application/json", Accept: "application/json" };
|
|
202
209
|
if (token) headers.Authorization = `Bearer ${token}`;
|
|
203
210
|
|
|
204
|
-
const response = await fetch(`${config.resolveBaseUrl()}/api/
|
|
211
|
+
const response = await fetch(`${config.resolveBaseUrl()}/api/v1/cli/events`, {
|
|
205
212
|
method: "POST",
|
|
206
213
|
headers,
|
|
207
214
|
body: JSON.stringify({
|
package/lib/workspace.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// small.
|
|
4
4
|
//
|
|
5
5
|
// What a `tools/*.yml` declares, which blocks `vatio.yml` accepts and whether
|
|
6
|
-
// any of it is valid are answered by POST /api/
|
|
6
|
+
// any of it is valid are answered by POST /api/v1/:slug/check. The one
|
|
7
7
|
// thing a client cannot ask the platform for is the address of that call: the
|
|
8
8
|
// slug is in its URL. So this reads `workspace:` and stops.
|
|
9
9
|
|