@vatio-ai/cli 0.78.0 → 0.80.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/README.md CHANGED
@@ -76,7 +76,7 @@ tokens list|create|origins|revoke Publishable tokens and the origins each accep
76
76
  auth --new-key Keypair that signs the visitor's JWT
77
77
  auth --supabase [URL] Your users sign in with Supabase: no keys, no code
78
78
 
79
- whatsapp | instagram Set up in the console; prints the link
79
+ whatsapp | instagram Set up in the inbox; prints the link
80
80
 
81
81
  docs [--save [PATH]] The whole developer contract
82
82
  config show|set|unset base_url and token, per developer
package/bin/vatio.mjs CHANGED
@@ -33,8 +33,8 @@ const RETIRED = {
33
33
  "or read the manifest at GET /api/developer/v1/:slug/manifest.",
34
34
  issue: "was removed: report a problem on the public repository it belongs to --\n" +
35
35
  "https://github.com/vatio-ai/cli/issues (or sdk, ios, ruby under github.com/vatio-ai).",
36
- widget: "was removed: `vatio env` prints the snippet and its token, and the look is edited on\n" +
37
- "the console's Widget page.",
36
+ widget: "was removed: `vatio env` prints the snippet and its token, and the look is edited in\n" +
37
+ "the inbox, under Channels → Widget.",
38
38
  mcp: "was removed. Point your coding agent at `vatio docs --save` and let it run the CLI.",
39
39
  update: "is npm's job now: `npx @vatio-ai/cli@latest` always runs the current release, and\n" +
40
40
  "`npm install -g @vatio-ai/cli@latest` updates a global install.",
@@ -73,7 +73,7 @@ export class ApiClient extends HttpClient {
73
73
  return this.get(`/env/${encode(name)}`);
74
74
  }
75
75
 
76
- // The project "Connect Supabase" picked in the console, if any.
76
+ // The project "Connect Supabase" picked in the inbox (Channels), if any.
77
77
  supabase() {
78
78
  return this.get("/supabase");
79
79
  }
@@ -1,8 +1,10 @@
1
- // whatsapp / instagram -- both are set up in the console now: connecting your
2
- // own number or account needs Meta's consent screen, and test phones and
3
- // accounts are a form with a code. The CLI only says where, and that depends
4
- // on whether the workspace has published: before, only the Test page is in the
5
- // console's sidebar; after, the channel's own page under Integrations.
1
+ // whatsapp / instagram -- both are set up in the inbox: connecting your own
2
+ // number or account needs Meta's consent screen, and test phones and accounts
3
+ // are a form with a code. The CLI only says where, and that depends on whether
4
+ // the workspace has published: before, the Test page, where test phones and
5
+ // accounts are verified; after, the channel's own page under Channels.
6
+ // vatio.ai/workspaces is only for a server too old to send the link, and
7
+ // redirects to the inbox.
6
8
  //
7
9
  // One thing about your own WhatsApp number is set here too: who the agent
8
10
  // answers on it (`vatio whatsapp only` / `everyone`). Everyone else's messages
@@ -16,7 +18,7 @@ const WHATSAPP_USAGE = "Usage: vatio whatsapp [only NUMBER [NUMBER]... | everyon
16
18
  export async function whatsapp(config, args = []) {
17
19
  const sub = args.shift();
18
20
  if (sub === undefined) {
19
- await inConsole(config, { name: "WhatsApp", key: "whatsapp", own: "number", test: "phone" });
21
+ await inInbox(config, { name: "WhatsApp", key: "whatsapp", own: "number", test: "phone" });
20
22
  return printAgentNumbers(config);
21
23
  }
22
24
  if (sub === "only") {
@@ -31,18 +33,18 @@ export async function whatsapp(config, args = []) {
31
33
  }
32
34
 
33
35
  export const instagram = (config) =>
34
- inConsole(config, { name: "Instagram", key: "instagram", own: "account", test: "account" });
36
+ inInbox(config, { name: "Instagram", key: "instagram", own: "account", test: "account" });
35
37
 
36
- async function inConsole(config, channel) {
38
+ async function inInbox(config, channel) {
37
39
  const status = await deployClient(config, config.resolveWorkspaceRequired()).deployStatus();
38
40
  const url = status[`${channel.key}_url`] ?? status.integrations_url ?? `${config.resolveBaseUrl()}/workspaces`;
39
41
  // An older server sends no `published`; a live deployment means the same.
40
42
  const published = status.published ?? Boolean(status.live);
41
43
 
42
44
  if (published) {
43
- console.log(`Connect your own ${channel.own} and manage test ${channel.test}s in the console:`);
45
+ console.log(`Connect your own ${channel.own} and manage test ${channel.test}s in the inbox, under Channels:`);
44
46
  } else {
45
- console.log(`Test ${channel.name} on the console's Test page: verify your ${channel.test} there and talk to your agent.`);
47
+ console.log(`Test ${channel.name} on the inbox's Test page: verify your ${channel.test} there and talk to your agent.`);
46
48
  }
47
49
  console.log(` ${url}`);
48
50
  }
@@ -52,7 +54,7 @@ async function setAgentNumbers(config, numbers) {
52
54
  printAnswers(await client.updateWhatsapp({ agent_numbers: numbers }));
53
55
  }
54
56
 
55
- // After the console link: a workspace with no number of its own has nothing
57
+ // After the inbox link: a workspace with no number of its own has nothing
56
58
  // more to show, and the link already says what to do.
57
59
  async function printAgentNumbers(config) {
58
60
  const client = deployClient(config, config.resolveWorkspaceRequired());
@@ -66,7 +68,7 @@ async function printAgentNumbers(config) {
66
68
 
67
69
  function printAnswers(number) {
68
70
  const list = Array.isArray(number.agent_numbers) ? number.agent_numbers : [];
69
- const live = number.live ? paint("green", "live") : paint("cyan", "paused: Live is off in the console");
71
+ const live = number.live ? paint("green", "live") : paint("cyan", "paused: Live is off in the inbox, under Channels → WhatsApp");
70
72
  console.log(`\n${number.display_phone_number ?? "Your number"}: ${live}`);
71
73
  if (list.length === 0) {
72
74
  console.log(" The agent answers everyone. To answer only some numbers: vatio whatsapp only +56912345678");
@@ -30,7 +30,7 @@ export async function chat(config, args) {
30
30
  if (REMOVED_FLAGS.some((flag) => arg === flag || arg.startsWith(`${flag}=`))) {
31
31
  fail(
32
32
  `\`${arg}\` was removed. A CLI chat is you, the developer holding the token. ` +
33
- "To test a real channel add a test phone or Instagram account in the console; " +
33
+ "To test a real channel add a test phone or Instagram account on the inbox's Test page; " +
34
34
  "to pick a deployment use --env."
35
35
  );
36
36
  }
@@ -71,6 +71,10 @@ your inbox.
71
71
  \`show\` prints the chat you are in, with every tool call the agent made. Give
72
72
  it an id to read any chat in the workspace -- one a visitor had on the web,
73
73
  WhatsApp or Instagram -- with the environment and deployment that answered it.
74
+ A [your backend] line under a tool call is how your backend answered it.
75
+ A [safeguard] line says which of Vatio's checks discarded or rewrote a draft,
76
+ and a [vatio] line marks a reply Vatio wrote because the agent's turn produced
77
+ none: why, and whether anything in your workspace caused it.
74
78
 
75
79
  The open chat per deployment is remembered in ${STATE_FILE}, so a second
76
80
  \`vatio chat\` continues the first. \`--new\` starts over as a visitor the
@@ -243,15 +247,64 @@ async function showChat(config, options, args) {
243
247
  if (limit) console.log(` [tool limit] ${limit}`);
244
248
  continue;
245
249
  }
246
- const flags = message.discarded ? " (discarded)" : "";
250
+ const safeguard = message.safeguard ?? null;
251
+ const flags = message.discarded
252
+ ? safeguard?.policy
253
+ ? ` (discarded by the ${safeguard.policy} safeguard)`
254
+ : " (discarded)"
255
+ : "";
247
256
  if (content !== "" || flags) console.log(`[${message.role}]${flags} ${content}`);
248
257
  for (const call of Array.isArray(message.tool_calls) ? message.tool_calls : []) {
249
258
  console.log(` -> ${call.name}(${truncate(JSON.stringify(call.arguments ?? {}), 400)})`);
259
+ if (call.backend) console.log(` [your backend] ${backendLine(call.backend)}`);
250
260
  }
261
+ if (safeguard) console.log(` [safeguard] ${safeguardLine(safeguard)}`);
262
+ if (message.fallback) console.log(` [vatio] ${fallbackLine(message.fallback)}`);
251
263
  }
252
264
  if (messages.length === 0) console.log("(no messages)");
253
265
  }
254
266
 
267
+ // How the developer's backend answered a tool call, as Vatio measured it.
268
+ // Anything but `ok` is the backend's to fix, not the agent's.
269
+ function backendLine(backend) {
270
+ const request = [backend.method, backend.url].filter(Boolean).join(" ");
271
+ const status = [backend.http_status && `HTTP ${backend.http_status}`, backend.outcome].filter(Boolean).join(" · ");
272
+ const failed = backend.outcome && backend.outcome !== "ok" ? " — failed in your backend, not in the agent" : "";
273
+ return `${request} → ${status} in ${backend.duration_ms ?? "?"} ms${failed}`;
274
+ }
275
+
276
+ // What a safeguard did to a draft, in words: Vatio::Safeguards' policies,
277
+ // which run on every reply and cannot be turned off.
278
+ function safeguardLine(safeguard) {
279
+ const detail = safeguard.detail ?? {};
280
+ const what =
281
+ safeguard.policy === "no_links"
282
+ ? `a link that is not in links:, instructions or a tool result (${asList(detail.forbidden_urls)})`
283
+ : safeguard.policy === "no_generated_media"
284
+ ? `embedded media (${asList(detail.markers)})`
285
+ : safeguard.policy === "no_empty_content"
286
+ ? "an empty draft"
287
+ : "a draft that broke a rule";
288
+ const action =
289
+ safeguard.action === "discarded"
290
+ ? "discarded it and asked the model again"
291
+ : "rewrote it before it went out";
292
+ return `${safeguard.policy}: ${what}; Vatio ${action}`;
293
+ }
294
+
295
+ // Why Vatio wrote this reply instead of the agent, and whose it is to fix.
296
+ function fallbackLine(fallback) {
297
+ const why = `Vatio wrote this reply because ${fallback.reason}.`;
298
+ if (fallback.owner === "vatio") return `${why} Not your agent: nothing in your workspace caused it.`;
299
+ if (fallback.cause === "tool_loop") return `${why} See which tool the agent repeated above, and what it answered.`;
300
+ return `${why} The fix is in your agent.`;
301
+ }
302
+
303
+ function asList(value) {
304
+ const items = Array.isArray(value) ? value : [];
305
+ return items.length > 0 ? truncate(items.join(", "), 200) : "not recorded";
306
+ }
307
+
255
308
  // Vatio::Runtime::ToolBudget's marks on a tool result, said on a line of their
256
309
  // own: the note rides at the end of the result and truncate() can cut it off,
257
310
  // which left a turn that ran out of calls looking like one that just stopped.
@@ -95,7 +95,8 @@ export async function push(config, args) {
95
95
 
96
96
  // The remote has to exist before the workspace can be checked: the slug is in
97
97
  // the URL of the call that checks it. It is created unnamed; the display name
98
- // is a workspace setting edited in the console, not part of a push.
98
+ // is the business name (`vatio business set --name`, or the inbox's Business
99
+ // page), not part of a push.
99
100
  const clients = workspacesClient(config);
100
101
  const created = !(await clients.workspaceExists(workspace));
101
102
  if (created) {
@@ -119,7 +120,7 @@ export async function push(config, args) {
119
120
 
120
121
  const landedOn = payload.environment ?? "preview";
121
122
  console.log(`Pushed deployment #${payload.deployment_id} to ${landedOn} (git_sha=${JSON.stringify(payload.git_sha ?? null)})`);
122
- // Where to try it: the console's test screen for that environment.
123
+ // Where to try it: the inbox's Test page for that environment.
123
124
  if (payload.share_url) console.log(`Try it: ${payload.share_url}`);
124
125
  for (const warning of asArray(payload.warnings)) console.log(` warning: ${warning}`);
125
126
  if (payload.preview_url) console.log(`Preview: ${payload.preview_url}`);
@@ -172,11 +173,18 @@ export async function publish(config, args) {
172
173
  }
173
174
 
174
175
  function regressionsMessage(error) {
176
+ const rows = asArray(error.body.regressions);
175
177
  const lines = [error.message];
176
- for (const row of asArray(error.body.regressions)) lines.push(` ${row.id} — ${row.title}`);
178
+ for (const row of rows) {
179
+ const untested = row.vatio_error ? " (not tested: an error on Vatio's side, not your agent)" : "";
180
+ lines.push(` ${row.id} — ${row.title}${untested}`);
181
+ }
182
+ const broken = rows.filter((row) => !row.vatio_error);
177
183
  lines.push(
178
184
  "",
179
- "Fix them, then `vatio push` and `vatio eval` again before publishing.",
185
+ broken.length > 0
186
+ ? "Fix them, then `vatio push` and `vatio eval` again before publishing."
187
+ : "Run `vatio eval` again, then publish.",
180
188
  "`vatio publish --force` publishes anyway: only if you know what you're doing."
181
189
  );
182
190
  return lines.join("\n");
@@ -203,6 +211,35 @@ export async function status(config) {
203
211
  `reads it — add \`knowledge: [${base.name}]\` to vatio.yml and push.`
204
212
  );
205
213
  }
214
+ printVatioSide(payload.vatio);
215
+ }
216
+
217
+ // Is it Vatio or is it me? The replies Vatio wrote here because the agent's
218
+ // turn produced none, split by whose they are to fix. Also on stderr, for the
219
+ // same reason as the warning above, and only when there is something to say:
220
+ // a line on every call would be noise to anything reading both.
221
+ function printVatioSide(vatio) {
222
+ if (!vatio) return;
223
+ const latest = asArray(vatio.fallback_replies?.latest);
224
+ const byCause = vatio.fallback_replies?.by_cause ?? {};
225
+ const total = Object.values(byCause).reduce((sum, count) => sum + Number(count), 0);
226
+ if (total === 0) return;
227
+
228
+ const counts = Object.entries(byCause)
229
+ .map(([cause, count]) => `${cause} ${count}`)
230
+ .join(", ");
231
+ console.error(`Replies Vatio wrote because the agent's turn produced none, last 7 days: ${total} (${counts}).`);
232
+ for (const reply of latest) {
233
+ const whose = reply.owner === "vatio" ? "Vatio's side, not your agent" : "your agent";
234
+ console.error(
235
+ ` ${reply.at} ${reply.environment} — ${reply.reason} (${whose}): vatio chat show ${reply.chat_id}`
236
+ );
237
+ }
238
+ if (latest.some((reply) => reply.owner === "vatio")) {
239
+ console.error(
240
+ ' Nothing to fix in your agent for those. If they keep happening, tell us: vatio feedback "…"'
241
+ );
242
+ }
206
243
  }
207
244
 
208
245
  export async function diff(config, args) {
@@ -3,8 +3,8 @@
3
3
  // There are two: preview, the next version, which `vatio push` updates and
4
4
  // where its knowledge changes and secret values sit on top of live; and live,
5
5
  // what visitors talk to. This hands over what an app needs to talk to one --
6
- // the publishable token and the widget snippet -- and the link to try it in
7
- // the console.
6
+ // the publishable token and the widget snippet -- and the link to try it on
7
+ // the inbox's Test page.
8
8
 
9
9
  import { deployClient } from "./deploy.mjs";
10
10
  import { fail, takeEnv } from "../support.mjs";
@@ -4,7 +4,7 @@
4
4
  // All print markdown, because the reader is usually a coding agent: `vatio
5
5
  // flags` is the document it fixes the agent from, `vatio eval` is the
6
6
  // evidence that the fix worked on preview before `vatio publish` takes it
7
- // live, and `vatio tools` is the console's Tools page for the failures nobody
7
+ // live, and `vatio tools` is the inbox's Tools page for the failures nobody
8
8
  // reported.
9
9
 
10
10
  import { mkdirSync, writeFileSync } from "node:fs";
@@ -69,7 +69,7 @@ export async function flags(config, args) {
69
69
  }
70
70
 
71
71
  // Each tool's calls, error rate, timeouts and p50/p95 latency over a period,
72
- // then the calls that failed with what your backend answered: the console's
72
+ // then the calls that failed with what your backend answered: the inbox's
73
73
  // Tools page.
74
74
  export async function tools(config, args) {
75
75
  const environment = takeEnv(args, { fallback: "live" });
@@ -116,7 +116,7 @@ export async function init(config, args) {
116
116
  if (agentsNote) console.log(agentsNote);
117
117
  if (!authorized) console.log(`Local only for now — \`vatio push\` is what creates ${slug} on the platform.`);
118
118
  if (!authorized && String(name ?? "").trim() !== "") {
119
- console.log("The display name is set in the console (the workspace's Brand page) once it exists.");
119
+ console.log("Set the display name once it exists: `vatio business set --name NAME`, or the inbox's Business page.");
120
120
  }
121
121
  console.log("");
122
122
  console.log("Next:");
@@ -162,7 +162,8 @@ function writeAgentsNote(target) {
162
162
 
163
163
  // The smallest file that deploys: which workspace, and what the agent does.
164
164
  // The slug is already validated as a slug, so it needs no quoting. The display
165
- // name is not here: it is a workspace setting, edited in the console.
165
+ // name is not here: it is the business name, set with `vatio business set --name`
166
+ // or on the inbox's Business page.
166
167
  function starterManifest(slug) {
167
168
  const lines = ["# Which Vatio workspace this directory deploys to.", `workspace: ${slug}`, ""];
168
169
  lines.push("agent:");
@@ -40,7 +40,7 @@ export async function supabaseAuth(config, args) {
40
40
 
41
41
  if (signInUrl && !/^https:\/\/[^/\s?#]+/.test(signInUrl)) fail("--sign-in-url must be an https url on your own site");
42
42
 
43
- // The console's "Connect Supabase" is the one explicit answer short of a URL
43
+ // "Connect Supabase" in the inbox (Channels) is the one explicit answer short of a URL
44
44
  // on the command line; a .env is a guess about which project the app uses.
45
45
  const connected = given ? null : await connectedProject(config, workspace);
46
46
  const found = connected ? {} : detect([process.cwd(), root]);
@@ -49,7 +49,7 @@ export async function supabaseAuth(config, args) {
49
49
  fail(
50
50
  "Could not find your Supabase project URL in a .env or src/integrations/supabase/client.ts.\n" +
51
51
  "Pass it: vatio auth --supabase https://<project-ref>.supabase.co\n" +
52
- "or connect Supabase in the console (Channels)."
52
+ "or connect Supabase in the inbox, under Channels → Supabase."
53
53
  );
54
54
  }
55
55
  if (!PROJECT_URL.test(url)) {
@@ -18,7 +18,7 @@ export class DeviceAuthClient {
18
18
  }
19
19
 
20
20
  // A `workspace` lets the page the developer signs in on wait for that push
21
- // and land on its test screen.
21
+ // and land on its Test page in the inbox.
22
22
  start({ workspace } = {}) {
23
23
  const body = {};
24
24
  if (workspace) body.workspace = workspace;
package/lib/help.mjs CHANGED
@@ -43,7 +43,8 @@ Commands default as listed.
43
43
  tested preview's version, and while it fails a
44
44
  report live passes; --force publishes anyway
45
45
  rollback Put live back to the previous snapshot: config and knowledge
46
- status Preview and live deployment state
46
+ status Preview and live deployment state, and the replies
47
+ Vatio wrote for the agent, and why
47
48
  env [preview|live] An environment: token, widget snippet, link,
48
49
  knowledge changes and conflicts (default: preview)
49
50
  env list Both environments and what each runs
@@ -65,7 +66,7 @@ Commands default as listed.
65
66
  Every open report: the conversation, what each tool
66
67
  answered, and what should have happened
67
68
  tools [--env NAME] [--period 1h|1d|7d|30d] [--json]
68
- The console's Tools page: each tool's calls, error
69
+ The inbox's Tools page: each tool's calls, error
69
70
  rate, timeouts and p50/p95, then the calls that
70
71
  failed with what your backend answered. Default:
71
72
  live, 7d
@@ -134,8 +135,8 @@ Commands default as listed.
134
135
  conversations with these numbers
135
136
 
136
137
  Channels:
137
- whatsapp Set up in the console; prints the link (Test page
138
- until you publish, then Integrations)
138
+ whatsapp Set up in the inbox; prints the link (Test page
139
+ until you publish, then Channels)
139
140
  whatsapp only NUMBER...|everyone
140
141
  Who the agent answers on your own number; the
141
142
  rest still reach the inbox
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vatio-ai/cli",
3
- "version": "0.78.0",
3
+ "version": "0.80.0",
4
4
  "description": "Vatio CLI — deploy and manage Vatio agent workspaces",
5
5
  "keywords": [
6
6
  "vatio",