@vatio-ai/cli 0.77.0 → 0.78.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/lib/commands/routines.mjs +12 -23
- package/lib/help.mjs +3 -2
- package/package.json +1 -1
|
@@ -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
|
|
package/lib/help.mjs
CHANGED
|
@@ -129,8 +129,9 @@ 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
137
|
whatsapp Set up in the console; prints the link (Test page
|