vessels 0.2.6 → 0.2.7
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 +63 -0
- package/dist/index.js +83 -8
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# vessels
|
|
2
|
+
|
|
3
|
+
CLI for [Vessels](https://vessels.app) — let your agent reach you.
|
|
4
|
+
|
|
5
|
+
Vessels is the communication layer between AI agents and their human operators. This CLI handles account setup, API key management, and webhook configuration.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g vessels
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Setup (Claude Code and AI assistants — fully non-interactive)
|
|
14
|
+
|
|
15
|
+
Two commands. One human step (the OTP from your inbox).
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Step 1 — send OTP to your email
|
|
19
|
+
vessels init --email me@example.com
|
|
20
|
+
|
|
21
|
+
# Step 2 — verify and complete setup (run with the code from your inbox)
|
|
22
|
+
vessels init --email me@example.com --otp 847293
|
|
23
|
+
|
|
24
|
+
# Output:
|
|
25
|
+
# VESSELS_API_KEY=vsl_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
26
|
+
# npm install vessels-sdk
|
|
27
|
+
|
|
28
|
+
# With webhook (optional — add once your server is deployed):
|
|
29
|
+
vessels init --email me@example.com --otp 847293 --webhook-url https://myapp.com/hooks/vessels
|
|
30
|
+
# Also prints: VESSELS_WEBHOOK_SECRET=whsec_xxx
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
`vessels init` creates an account if you don't have one, then creates an API key (and optional webhook endpoint), and prints copy-ready `.env` entries. It's designed for Claude Code or any AI assistant to drive autonomously — the only human touch point is entering the 6-digit OTP.
|
|
34
|
+
|
|
35
|
+
## All commands
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
vessels init --email <email> [--otp <code>] [--name <key-name>] [--webhook-url <url>]
|
|
39
|
+
First-time setup. Run once to send OTP, re-run with --otp to complete.
|
|
40
|
+
|
|
41
|
+
vessels login [--email <email>] [--otp <code>]
|
|
42
|
+
vessels logout
|
|
43
|
+
vessels whoami
|
|
44
|
+
|
|
45
|
+
vessels keys list
|
|
46
|
+
vessels keys create [--name <name>]
|
|
47
|
+
vessels keys revoke <id>
|
|
48
|
+
|
|
49
|
+
vessels webhooks list
|
|
50
|
+
vessels webhooks create --url <https://...> [--events interaction.response,message.user]
|
|
51
|
+
vessels webhooks delete <id>
|
|
52
|
+
vessels webhooks enable <id>
|
|
53
|
+
vessels webhooks disable <id>
|
|
54
|
+
|
|
55
|
+
vessels push --vessel <id> --message <text> --key <vsl_xxx>
|
|
56
|
+
vessels message --vessel <id> --message <text>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Full reference
|
|
60
|
+
|
|
61
|
+
- SDK: [vessels-sdk on npm](https://www.npmjs.com/package/vessels-sdk)
|
|
62
|
+
- Docs: [vessels.app/docs](https://vessels.app/docs)
|
|
63
|
+
- AI-readable reference: [vessels.app/llms-full.txt](https://vessels.app/llms-full.txt)
|
package/dist/index.js
CHANGED
|
@@ -291,14 +291,93 @@ async function cmdPush(args) {
|
|
|
291
291
|
}
|
|
292
292
|
console.log(`Message sent. vessel_id=${data.vessel_id} message_id=${data.message_id}`);
|
|
293
293
|
}
|
|
294
|
+
async function cmdInit(args) {
|
|
295
|
+
const flags = parseFlags(args);
|
|
296
|
+
const email = flags.email || await prompt("Email: ");
|
|
297
|
+
if (!flags.otp) {
|
|
298
|
+
const res = await fetch(`${BASE_URL}/api/v1/auth/otp/send`, {
|
|
299
|
+
method: "POST",
|
|
300
|
+
headers: { "Content-Type": "application/json" },
|
|
301
|
+
body: JSON.stringify({ email })
|
|
302
|
+
});
|
|
303
|
+
if (!res.ok) {
|
|
304
|
+
const data = await res.json();
|
|
305
|
+
console.error("Failed to send code:", data.error);
|
|
306
|
+
process.exit(1);
|
|
307
|
+
}
|
|
308
|
+
console.log(`
|
|
309
|
+
OTP sent to ${email}.
|
|
310
|
+
`);
|
|
311
|
+
const webhookFlag = flags["webhook-url"] ? ` --webhook-url ${flags["webhook-url"]}` : "";
|
|
312
|
+
const nameFlag = flags.name ? ` --name ${flags.name}` : "";
|
|
313
|
+
console.log(`Run:
|
|
314
|
+
|
|
315
|
+
vessels init --email ${email} --otp <code>${nameFlag}${webhookFlag}
|
|
316
|
+
`);
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
const verifyRes = await fetch(`${BASE_URL}/api/v1/auth/otp/verify`, {
|
|
320
|
+
method: "POST",
|
|
321
|
+
headers: { "Content-Type": "application/json" },
|
|
322
|
+
body: JSON.stringify({ email, token: flags.otp })
|
|
323
|
+
});
|
|
324
|
+
const verifyData = await verifyRes.json();
|
|
325
|
+
if (!verifyRes.ok) {
|
|
326
|
+
console.error("Invalid or expired code.");
|
|
327
|
+
process.exit(1);
|
|
328
|
+
}
|
|
329
|
+
writeConfig({ access_token: verifyData.access_token, refresh_token: verifyData.refresh_token, email });
|
|
330
|
+
await api("/api/v1/me");
|
|
331
|
+
const keyData = await api("/api/v1/keys", {
|
|
332
|
+
method: "POST",
|
|
333
|
+
body: JSON.stringify({ name: flags.name || "default" })
|
|
334
|
+
});
|
|
335
|
+
console.log(`
|
|
336
|
+
Setup complete.
|
|
337
|
+
`);
|
|
338
|
+
console.log(`Add to your .env file:
|
|
339
|
+
`);
|
|
340
|
+
console.log(` VESSELS_API_KEY=${keyData.key}`);
|
|
341
|
+
if (flags["webhook-url"]) {
|
|
342
|
+
const webhookData = await api("/api/v1/webhooks", {
|
|
343
|
+
method: "POST",
|
|
344
|
+
body: JSON.stringify({ url: flags["webhook-url"], events: ["interaction.response", "message.user"] })
|
|
345
|
+
});
|
|
346
|
+
console.log(` VESSELS_WEBHOOK_SECRET=${webhookData.endpoint.secret}`);
|
|
347
|
+
}
|
|
348
|
+
console.log(`
|
|
349
|
+
Install the SDK:
|
|
350
|
+
|
|
351
|
+
npm install vessels-sdk
|
|
352
|
+
`);
|
|
353
|
+
if (!flags["webhook-url"]) {
|
|
354
|
+
console.log(`To receive webhooks (once your server is deployed):
|
|
355
|
+
`);
|
|
356
|
+
console.log(` vessels webhooks create --url https://your-app.com/hooks/vessels
|
|
357
|
+
`);
|
|
358
|
+
}
|
|
359
|
+
console.log(`Full reference: https://vessels.app/llms-full.txt`);
|
|
360
|
+
}
|
|
294
361
|
var [, , cmd, sub, ...rest] = process.argv;
|
|
295
362
|
var HELP = `
|
|
296
363
|
vessels \u2014 CLI for Vessels (vessels.app)
|
|
297
364
|
|
|
365
|
+
Quick setup (Claude Code / AI agents \u2014 fully non-interactive):
|
|
366
|
+
|
|
367
|
+
vessels init --email me@example.com
|
|
368
|
+
# Vessels emails you a 6-digit code. Then run:
|
|
369
|
+
vessels init --email me@example.com --otp 847293
|
|
370
|
+
# Prints VESSELS_API_KEY=vsl_xxx and npm install vessels-sdk
|
|
371
|
+
|
|
372
|
+
# With a webhook (optional, run once your server is deployed):
|
|
373
|
+
vessels init --email me@example.com --otp 847293 --webhook-url https://myapp.com/hooks/vessels
|
|
374
|
+
|
|
298
375
|
Commands:
|
|
299
|
-
vessels
|
|
300
|
-
|
|
376
|
+
vessels init --email <email> [--otp <code>] [--name <key-name>] [--webhook-url <url>]
|
|
377
|
+
First-time setup: account + API key (+ webhook). Two-step: run once to send OTP,
|
|
378
|
+
re-run with --otp to complete. Prints copy-ready .env entries.
|
|
301
379
|
|
|
380
|
+
vessels login [--email <email>] [--otp <code>]
|
|
302
381
|
vessels logout
|
|
303
382
|
vessels whoami
|
|
304
383
|
|
|
@@ -319,18 +398,14 @@ Commands:
|
|
|
319
398
|
Send a message as the logged-in user and print webhook delivery logs.
|
|
320
399
|
Accepts vessel UUID or external_id (e.g. booking-123).
|
|
321
400
|
|
|
322
|
-
|
|
323
|
-
vessels login --email me@example.com
|
|
324
|
-
# tell your agent the OTP from the email
|
|
325
|
-
vessels login --email me@example.com --otp 847293
|
|
326
|
-
vessels keys create --name my-project
|
|
327
|
-
vessels webhooks create --url https://myapp.com/hooks/vessels
|
|
401
|
+
Full reference: https://vessels.app/llms-full.txt
|
|
328
402
|
`;
|
|
329
403
|
async function main() {
|
|
330
404
|
if (!cmd || cmd === "help" || cmd === "--help" || cmd === "-h") {
|
|
331
405
|
console.log(HELP);
|
|
332
406
|
return;
|
|
333
407
|
}
|
|
408
|
+
if (cmd === "init") return cmdInit([sub, ...rest].filter(Boolean));
|
|
334
409
|
if (cmd === "login" || cmd === "signup") return cmdLogin([sub, ...rest].filter(Boolean));
|
|
335
410
|
if (cmd === "logout") return cmdLogout();
|
|
336
411
|
if (cmd === "whoami") return cmdWhoami();
|