@vatio-ai/cli 0.77.0 → 0.79.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 +1 -1
- package/bin/vatio.mjs +2 -2
- package/lib/api-client.mjs +1 -1
- package/lib/commands/channels.mjs +14 -12
- package/lib/commands/chat.mjs +1 -1
- package/lib/commands/deploy.mjs +3 -2
- package/lib/commands/env.mjs +2 -2
- package/lib/commands/improve.mjs +2 -2
- package/lib/commands/misc.mjs +3 -2
- package/lib/commands/routines.mjs +12 -23
- package/lib/commands/supabase-auth.mjs +2 -2
- package/lib/device-auth.mjs +1 -1
- package/lib/help.mjs +6 -5
- package/package.json +1 -1
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
|
|
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
|
|
37
|
-
"the
|
|
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.",
|
package/lib/api-client.mjs
CHANGED
|
@@ -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
|
|
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
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
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
|
|
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
|
-
|
|
36
|
+
inInbox(config, { name: "Instagram", key: "instagram", own: "account", test: "account" });
|
|
35
37
|
|
|
36
|
-
async function
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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");
|
package/lib/commands/chat.mjs
CHANGED
|
@@ -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
|
|
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
|
}
|
package/lib/commands/deploy.mjs
CHANGED
|
@@ -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
|
|
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
|
|
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}`);
|
package/lib/commands/env.mjs
CHANGED
|
@@ -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
|
|
7
|
-
// the
|
|
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";
|
package/lib/commands/improve.mjs
CHANGED
|
@@ -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
|
|
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
|
|
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" });
|
package/lib/commands/misc.mjs
CHANGED
|
@@ -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("
|
|
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
|
|
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:");
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
// `vatio routines` — Claude Code routines
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
1
|
+
// `vatio routines` — Claude Code routines the agent can hand work to. A routine
|
|
2
|
+
// is the trigger and token of one on claude.ai, and the WhatsApp numbers whose
|
|
3
|
+
// conversations may use it; the agent gets it as a tool in the manifest
|
|
4
|
+
// (tools/<key>.yml with `routine: <name>`). Calling it starts the routine with
|
|
5
|
+
// where the conversation is, and Claude reads it with a server key
|
|
6
|
+
// (GET /api/server/v1/:ws/chats/:id/messages).
|
|
5
7
|
|
|
6
8
|
import { deployClient } from "./deploy.mjs";
|
|
7
9
|
import { askSecret, fail, paint, sleep, takeEnv, takeFlag, takeValue } from "../support.mjs";
|
|
8
10
|
|
|
9
11
|
const WAIT_INTERVAL_MS = 2_000;
|
|
10
12
|
|
|
11
|
-
const CREATE_USAGE = "vatio routines create NAME --url URL --phone NUMBER [--phone NUMBER]... "
|
|
12
|
-
|
|
13
|
-
const UPDATE_USAGE = "vatio routines update ID [--name NAME] [--url URL] [--phone NUMBER]... [--new-token] " +
|
|
14
|
-
"[--quiet SECONDS]";
|
|
13
|
+
const CREATE_USAGE = "vatio routines create NAME --url URL --phone NUMBER [--phone NUMBER]... [--env NAME]";
|
|
14
|
+
const UPDATE_USAGE = "vatio routines update ID [--name NAME] [--url URL] [--phone NUMBER]... [--new-token]";
|
|
15
15
|
const USAGE = `Usage: vatio routines list|create NAME …|update ID …|test ID|runs ID|enable ID|rm ID\n` +
|
|
16
16
|
` ${CREATE_USAGE}\n ${UPDATE_USAGE}`;
|
|
17
17
|
|
|
@@ -22,14 +22,6 @@ function takeAll(args, name) {
|
|
|
22
22
|
return values;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
function takeQuiet(args) {
|
|
26
|
-
const raw = takeValue(args, "--quiet");
|
|
27
|
-
if (raw === null) return null;
|
|
28
|
-
const seconds = Number(raw);
|
|
29
|
-
if (!Number.isInteger(seconds)) fail("--quiet is a whole number of seconds, between 5 and 600");
|
|
30
|
-
return seconds;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
25
|
export async function routines(config, args) {
|
|
34
26
|
const json = takeFlag(args, "--json");
|
|
35
27
|
const workspace = config.resolveWorkspaceRequired();
|
|
@@ -54,7 +46,6 @@ export async function routines(config, args) {
|
|
|
54
46
|
const environment = takeEnv(args, { fallback: "live" });
|
|
55
47
|
const url = takeValue(args, "--url");
|
|
56
48
|
const phoneNumbers = takeAll(args, "--phone");
|
|
57
|
-
const quiet = takeQuiet(args);
|
|
58
49
|
const name = args.shift();
|
|
59
50
|
if (!name || !url || phoneNumbers.length === 0 || args.length > 0) fail(`Usage: ${CREATE_USAGE}`);
|
|
60
51
|
|
|
@@ -64,7 +55,6 @@ export async function routines(config, args) {
|
|
|
64
55
|
if (token === "") fail("No token given. claude.ai shows it once, when you generate it on the routine's API trigger.");
|
|
65
56
|
|
|
66
57
|
const body = { environment, name, url, token, phone_numbers: phoneNumbers };
|
|
67
|
-
if (quiet !== null) body.quiet_seconds = quiet;
|
|
68
58
|
const routine = await client.createRoutine(body);
|
|
69
59
|
if (json) return console.log(JSON.stringify(routine, null, 2));
|
|
70
60
|
console.log(`${paint("green", "✓")} Created routine #${routine.id} (${routine.name}) on ${routine.environment}`);
|
|
@@ -72,7 +62,9 @@ export async function routines(config, args) {
|
|
|
72
62
|
console.log("");
|
|
73
63
|
console.log("Give the routine a server key so it can read the conversation: vatio keys create --env " +
|
|
74
64
|
`${routine.environment} --label ${routine.name}`);
|
|
75
|
-
console.log(`
|
|
65
|
+
console.log(`Check it starts: vatio routines test ${routine.id}`);
|
|
66
|
+
console.log(`Then give it to the agent: tools/${routine.name}.yml with \`routine: ${routine.name}\`, ` +
|
|
67
|
+
`${routine.name} in agent.tools, and vatio push`);
|
|
76
68
|
return;
|
|
77
69
|
}
|
|
78
70
|
|
|
@@ -81,7 +73,6 @@ export async function routines(config, args) {
|
|
|
81
73
|
const url = takeValue(args, "--url");
|
|
82
74
|
const phoneNumbers = takeAll(args, "--phone");
|
|
83
75
|
const newToken = takeFlag(args, "--new-token");
|
|
84
|
-
const quiet = takeQuiet(args);
|
|
85
76
|
const id = args.shift();
|
|
86
77
|
if (!id || args.length > 0) fail(`Usage: ${UPDATE_USAGE}`);
|
|
87
78
|
|
|
@@ -89,7 +80,6 @@ export async function routines(config, args) {
|
|
|
89
80
|
if (name !== null) body.name = name;
|
|
90
81
|
if (url !== null) body.url = url;
|
|
91
82
|
if (phoneNumbers.length > 0) body.phone_numbers = phoneNumbers;
|
|
92
|
-
if (quiet !== null) body.quiet_seconds = quiet;
|
|
93
83
|
if (newToken) {
|
|
94
84
|
body.token = await askSecret(`${paint("green", "?")} Paste the new API token: `);
|
|
95
85
|
if (body.token === "") fail("No token given");
|
|
@@ -159,8 +149,7 @@ export async function routines(config, args) {
|
|
|
159
149
|
function printRoutine(routine) {
|
|
160
150
|
const state = routine.enabled ? paint("green", "enabled") : paint("red", "disabled");
|
|
161
151
|
console.log(` #${routine.id} ${routine.name} ${routine.environment} ${state}`);
|
|
162
|
-
console.log(`
|
|
163
|
-
console.log(` waits ${routine.quiet_seconds}s after the last message, then fires and the agent answers` +
|
|
152
|
+
console.log(` the agent can use it with: ${routine.phone_numbers.join(", ")}` +
|
|
164
153
|
(routine.consecutive_failures > 0 ? ` failing: ${routine.consecutive_failures} in a row` : ""));
|
|
165
154
|
}
|
|
166
155
|
|
|
@@ -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
|
-
//
|
|
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
|
|
52
|
+
"or connect Supabase in the inbox, under Channels → Supabase."
|
|
53
53
|
);
|
|
54
54
|
}
|
|
55
55
|
if (!PROJECT_URL.test(url)) {
|
package/lib/device-auth.mjs
CHANGED
|
@@ -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
|
|
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
|
@@ -65,7 +65,7 @@ Commands default as listed.
|
|
|
65
65
|
Every open report: the conversation, what each tool
|
|
66
66
|
answered, and what should have happened
|
|
67
67
|
tools [--env NAME] [--period 1h|1d|7d|30d] [--json]
|
|
68
|
-
The
|
|
68
|
+
The inbox's Tools page: each tool's calls, error
|
|
69
69
|
rate, timeouts and p50/p95, then the calls that
|
|
70
70
|
failed with what your backend answered. Default:
|
|
71
71
|
live, 7d
|
|
@@ -129,12 +129,13 @@ Commands default as listed.
|
|
|
129
129
|
|
|
130
130
|
Claude Code routines (WhatsApp):
|
|
131
131
|
routines list|create NAME --url URL --phone NUMBER...|update ID|test ID|runs ID|enable ID|rm ID
|
|
132
|
-
A routine on claude.ai
|
|
133
|
-
|
|
132
|
+
A routine on claude.ai the agent hands work to, as a
|
|
133
|
+
tool (tools/NAME.yml with routine: NAME), in
|
|
134
|
+
conversations with these numbers
|
|
134
135
|
|
|
135
136
|
Channels:
|
|
136
|
-
whatsapp Set up in the
|
|
137
|
-
until you publish, then
|
|
137
|
+
whatsapp Set up in the inbox; prints the link (Test page
|
|
138
|
+
until you publish, then Channels)
|
|
138
139
|
whatsapp only NUMBER...|everyone
|
|
139
140
|
Who the agent answers on your own number; the
|
|
140
141
|
rest still reach the inbox
|