@vatio-ai/cli 0.79.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.
@@ -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.
@@ -173,11 +173,18 @@ export async function publish(config, args) {
173
173
  }
174
174
 
175
175
  function regressionsMessage(error) {
176
+ const rows = asArray(error.body.regressions);
176
177
  const lines = [error.message];
177
- 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);
178
183
  lines.push(
179
184
  "",
180
- "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.",
181
188
  "`vatio publish --force` publishes anyway: only if you know what you're doing."
182
189
  );
183
190
  return lines.join("\n");
@@ -204,6 +211,35 @@ export async function status(config) {
204
211
  `reads it — add \`knowledge: [${base.name}]\` to vatio.yml and push.`
205
212
  );
206
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
+ }
207
243
  }
208
244
 
209
245
  export async function diff(config, args) {
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vatio-ai/cli",
3
- "version": "0.79.0",
3
+ "version": "0.80.0",
4
4
  "description": "Vatio CLI — deploy and manage Vatio agent workspaces",
5
5
  "keywords": [
6
6
  "vatio",