@vatio-ai/cli 0.83.0 → 0.84.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.
@@ -176,13 +176,13 @@ export class ApiClient extends HttpClient {
176
176
 
177
177
  // --- business -------------------------------------------------------
178
178
 
179
- // Name, description and opening hours: one row for every environment,
180
- // the same one the inbox's Business page edits.
179
+ // Name, description and brand: one row for every environment, the same
180
+ // one the inbox's Business page edits.
181
181
  business() {
182
182
  return this.get("/business");
183
183
  }
184
184
 
185
- // Only the keys given change. `hours: null` clears the schedule.
185
+ // Only the keys given change.
186
186
  updateBusiness(fields) {
187
187
  return this.patch("/business", fields);
188
188
  }
@@ -1,5 +1,5 @@
1
- // business — the business the agent works for: name, description, opening
2
- // hours and brand (logo, color, about). Not part of vatio.yml: it belongs to
1
+ // business — the business the agent works for: name, description and brand
2
+ // (logo, color, about). Not part of vatio.yml: it belongs to
3
3
  // whoever runs the business and is usually edited on the inbox's Business
4
4
  // page. This is the same row, for a developer setting a workspace up from a
5
5
  // terminal. One value for every environment, live on save.
@@ -7,11 +7,8 @@
7
7
  import { readFileSync, statSync } from "node:fs";
8
8
  import { basename, extname } from "node:path";
9
9
  import { deployClient } from "./deploy.mjs";
10
- import { fail, paint, takeFlag, takeValue } from "../support.mjs";
10
+ import { fail, takeFlag, takeValue } from "../support.mjs";
11
11
 
12
- const DAYS = ["mon", "tue", "wed", "thu", "fri", "sat", "sun"];
13
- const DAY_LABELS = { mon: "Mon", tue: "Tue", wed: "Wed", thu: "Thu", fri: "Fri", sat: "Sat", sun: "Sun" };
14
- const RANGE = /^\d{2}:\d{2}-\d{2}:\d{2}$/;
15
12
  const HEX = /^#[0-9a-fA-F]{6}$/;
16
13
  // The platform checks the type and the size again; these only fail early.
17
14
  const LOGO_TYPES = { ".png": "image/png", ".jpg": "image/jpeg", ".jpeg": "image/jpeg", ".webp": "image/webp", ".gif": "image/gif" };
@@ -21,9 +18,7 @@ const USAGE =
21
18
  "Usage: vatio business [show]\n" +
22
19
  " vatio business set [--name NAME] [--description TEXT | --description-file FILE]\n" +
23
20
  " [--about TEXT] [--color #RRGGBB | --color default]\n" +
24
- " [--logo FILE | --remove-logo]\n" +
25
- " vatio business hours [--timezone ZONE] [--mon 09:00-18:00] [--tue 09:00-13:00,14:00-18:00] ...\n" +
26
- " vatio business hours --clear";
21
+ " [--logo FILE | --remove-logo]";
27
22
 
28
23
  export async function business(config, args) {
29
24
  const workspace = config.resolveWorkspaceRequired();
@@ -65,38 +60,10 @@ export async function business(config, args) {
65
60
  return;
66
61
  }
67
62
  if (sub === "hours") {
68
- if (takeFlag(args, "--clear")) {
69
- rejectLeftovers(args);
70
- print(await client.updateBusiness({ hours: null }), workspace);
71
- return;
72
- }
73
-
74
- const timezone = takeValue(args, "--timezone") ?? takeValue(args, "--tz");
75
- const days = {};
76
- for (const day of DAYS) {
77
- const value = takeValue(args, `--${day}`);
78
- if (value === null) continue;
79
- const ranges = value.split(",").map((range) => range.trim()).filter(Boolean);
80
- const bad = ranges.find((range) => !RANGE.test(range));
81
- if (bad) fail(`--${day}: "${bad}" is not a range like 09:00-18:00`);
82
- if (ranges.length > 0) days[day] = ranges;
83
- }
84
- rejectLeftovers(args);
85
-
86
- // Nothing to change: show them.
87
- if (timezone === null && Object.keys(days).length === 0) {
88
- print(await client.business(), workspace);
89
- return;
90
- }
91
- if (Object.keys(days).length === 0) {
92
- fail("Give at least one day (--mon 09:00-18:00 ...), or --clear for someone always available");
93
- }
94
-
95
- // The week is replaced as a whole -- a day not given is a day nobody is
96
- // on -- so the timezone is the only thing worth keeping from before.
97
- const zone = timezone ?? (await client.business()).hours?.timezone ?? localTimezone();
98
- print(await client.updateBusiness({ hours: { timezone: zone, days } }), workspace);
99
- return;
63
+ fail(
64
+ "Business hours were removed. To have a person take a conversation over, give the agent a tool " +
65
+ "that alerts your team: https://vatio.ai/docs/handoff",
66
+ );
100
67
  }
101
68
 
102
69
  fail(USAGE);
@@ -120,12 +87,6 @@ function rejectLeftovers(args) {
120
87
  if (args.length > 0) fail(`Unexpected: ${args.join(" ")}\n\n${USAGE}`);
121
88
  }
122
89
 
123
- function localTimezone() {
124
- const zone = Intl.DateTimeFormat().resolvedOptions().timeZone;
125
- if (zone && zone.includes("/")) return zone;
126
- fail("Give --timezone, like --timezone America/Santiago");
127
- }
128
-
129
90
  function print(payload, workspace) {
130
91
  console.log(`${payload.name} (workspace ${workspace})`);
131
92
  console.log("");
@@ -136,30 +97,6 @@ function print(payload, workspace) {
136
97
  console.log(` logo ${payload.logo_url ?? "none (vatio business set --logo FILE)"}`);
137
98
  console.log(` color ${payload.accent_color ?? `${payload.default_accent_color} (Vatio's default)`}`);
138
99
  console.log(` about ${payload.about ? payload.about.replace(/\s*\n\s*/g, " ") : "none"}`);
139
- console.log("");
140
-
141
- if (!payload.hours) {
142
- console.log("Hours: none set — someone is always available");
143
- } else {
144
- const state = payload.open_now ? paint("green", "open now") : "closed now";
145
- console.log(`Hours (${payload.hours.timezone}) — ${state}`);
146
- for (const day of DAYS) {
147
- const ranges = payload.hours.days?.[day] ?? [];
148
- console.log(` ${DAY_LABELS[day]} ${ranges.length > 0 ? ranges.join(", ") : "closed"}`);
149
- }
150
- if (payload.next_opening) console.log(` Opens next ${payload.next_opening}`);
151
- }
152
-
153
- console.log("");
154
- if (!payload.handoff) {
155
- console.log("Handoff: not declared in vatio.yml — the agent never hands a conversation over");
156
- return;
157
- }
158
- console.log("Hands over to a person when (from vatio.yml):");
159
- const rules = [...(payload.handoff.when ?? [])];
160
- if (payload.handoff.after_turns != null) rules.push(`always after ${payload.handoff.after_turns} visitor messages`);
161
- if (rules.length === 0) rules.push("the agent judges it");
162
- for (const rule of rules) console.log(` - ${rule}`);
163
100
  }
164
101
 
165
102
  function indent(text) {
package/lib/help.mjs CHANGED
@@ -101,12 +101,9 @@ Commands default as listed.
101
101
 
102
102
  Business (one value for every environment, live on save; also on the inbox's
103
103
  Business page):
104
- business [show] Name, description, brand, opening hours, handoff rules
104
+ business [show] Name, description, brand
105
105
  business set [--name NAME] [--description TEXT | --description-file FILE]
106
106
  [--about TEXT] [--color #RRGGBB|default] [--logo FILE | --remove-logo]
107
- business hours --timezone ZONE --mon 09:00-18:00 --tue 09:00-13:00,14:00-18:00 ...
108
- Replaces the week: a day not given is closed
109
- business hours --clear No hours: someone is always available
110
107
 
111
108
  Credentials:
112
109
  secrets list|set KEY [VALUE]|rm KEY [--env NAME | --tests]
package/lib/telemetry.mjs CHANGED
@@ -28,7 +28,7 @@ const SUBCOMMANDS = {
28
28
  chat: ["show"],
29
29
  env: ["list", "rm"],
30
30
  kb: ["list", "show", "create", "rm", "write", "cat", "rm-entry", "status", "publish", "history"],
31
- business: ["show", "set", "hours"],
31
+ business: ["show", "set"],
32
32
  secrets: ["list", "set", "rm"],
33
33
  tokens: ["list", "create", "revoke", "origins"],
34
34
  keys: ["list", "create", "revoke"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vatio-ai/cli",
3
- "version": "0.83.0",
3
+ "version": "0.84.0",
4
4
  "description": "Vatio CLI — deploy and manage Vatio agent workspaces",
5
5
  "keywords": [
6
6
  "vatio",