vessels 0.2.5 → 0.2.6

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.
Files changed (2) hide show
  1. package/dist/index.js +28 -22
  2. package/package.json +2 -4
package/dist/index.js CHANGED
@@ -1,14 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/index.ts
4
- import { createClient } from "@supabase/supabase-js";
5
4
  import { readFileSync, writeFileSync, mkdirSync, existsSync } from "fs";
6
5
  import { homedir } from "os";
7
6
  import { join } from "path";
8
7
  import * as readline from "readline/promises";
9
- var BASE_URL = "https://vessels-two.vercel.app";
10
- var SUPABASE_URL = "https://vnlrstpwkizhidvwhoom.supabase.co";
11
- var SUPABASE_ANON_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InZubHJzdHB3a2l6aGlkdndob29tIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzU1ODIzMDgsImV4cCI6MjA5MTE1ODMwOH0.tz1k8MH_1G8M0qZncfFV8eA8NmGKZXvzUk3r1dylAhs";
8
+ var BASE_URL = "https://vessels.app";
12
9
  var CONFIG_DIR = join(homedir(), ".vessels");
13
10
  var CONFIG_FILE = join(CONFIG_DIR, "config.json");
14
11
  function readConfig() {
@@ -37,11 +34,15 @@ async function getFreshToken() {
37
34
  if (!isTokenExpired(config.access_token)) return config.access_token;
38
35
  if (config.refresh_token) {
39
36
  try {
40
- const supabase = createClient(SUPABASE_URL, SUPABASE_ANON_KEY);
41
- const { data } = await supabase.auth.refreshSession({ refresh_token: config.refresh_token });
42
- if (data.session) {
43
- writeConfig({ ...config, access_token: data.session.access_token, refresh_token: data.session.refresh_token });
44
- return data.session.access_token;
37
+ const res = await fetch(`${BASE_URL}/api/v1/auth/refresh`, {
38
+ method: "POST",
39
+ headers: { "Content-Type": "application/json" },
40
+ body: JSON.stringify({ refresh_token: config.refresh_token })
41
+ });
42
+ if (res.ok) {
43
+ const data = await res.json();
44
+ writeConfig({ ...config, access_token: data.access_token, refresh_token: data.refresh_token });
45
+ return data.access_token;
45
46
  }
46
47
  } catch {
47
48
  }
@@ -82,12 +83,16 @@ function parseFlags(args) {
82
83
  }
83
84
  async function cmdLogin(args) {
84
85
  const flags = parseFlags(args);
85
- const supabase = createClient(SUPABASE_URL, SUPABASE_ANON_KEY);
86
86
  const email = flags.email || await prompt("Email: ");
87
87
  if (!flags.otp) {
88
- const { error: otpError } = await supabase.auth.signInWithOtp({ email });
89
- if (otpError) {
90
- console.error("Failed to send code:", otpError.message);
88
+ const res2 = await fetch(`${BASE_URL}/api/v1/auth/otp/send`, {
89
+ method: "POST",
90
+ headers: { "Content-Type": "application/json" },
91
+ body: JSON.stringify({ email })
92
+ });
93
+ if (!res2.ok) {
94
+ const data2 = await res2.json();
95
+ console.error("Failed to send code:", data2.error);
91
96
  process.exit(1);
92
97
  }
93
98
  console.log(`OTP sent to ${email}.`);
@@ -97,16 +102,17 @@ async function cmdLogin(args) {
97
102
  }
98
103
  }
99
104
  const otp = flags.otp || await prompt("Code: ");
100
- const { data, error } = await supabase.auth.verifyOtp({ email, token: otp, type: "email" });
101
- if (error || !data.session) {
105
+ const res = await fetch(`${BASE_URL}/api/v1/auth/otp/verify`, {
106
+ method: "POST",
107
+ headers: { "Content-Type": "application/json" },
108
+ body: JSON.stringify({ email, token: otp })
109
+ });
110
+ const data = await res.json();
111
+ if (!res.ok) {
102
112
  console.error("Invalid or expired code.");
103
113
  process.exit(1);
104
114
  }
105
- writeConfig({
106
- access_token: data.session.access_token,
107
- refresh_token: data.session.refresh_token,
108
- email
109
- });
115
+ writeConfig({ access_token: data.access_token, refresh_token: data.refresh_token, email });
110
116
  await api("/api/v1/me");
111
117
  console.log(`Logged in as ${email}`);
112
118
  }
@@ -237,7 +243,7 @@ Sent.`);
237
243
  const logsData = await api(`/api/v1/webhooks/deliveries?since=${encodeURIComponent(since)}&limit=10`);
238
244
  const deliveries = logsData.deliveries ?? [];
239
245
  if (!deliveries.length) {
240
- console.log("\nNo webhook deliveries \u2014 add an endpoint at vessels-two.vercel.app/settings/webhooks");
246
+ console.log("\nNo webhook deliveries \u2014 add an endpoint at vessels.app/settings/webhooks");
241
247
  return;
242
248
  }
243
249
  console.log(`
@@ -287,7 +293,7 @@ async function cmdPush(args) {
287
293
  }
288
294
  var [, , cmd, sub, ...rest] = process.argv;
289
295
  var HELP = `
290
- vessels \u2014 CLI for Vessels (vessels-two.vercel.app)
296
+ vessels \u2014 CLI for Vessels (vessels.app)
291
297
 
292
298
  Commands:
293
299
  vessels login [--email <email>] [--otp <code>]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vessels",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "Vessels CLI — manage your agent communication layer from the terminal",
5
5
  "type": "module",
6
6
  "bin": {
@@ -20,7 +20,5 @@
20
20
  "typescript": "^5",
21
21
  "@types/node": "^25.5.2"
22
22
  },
23
- "dependencies": {
24
- "@supabase/supabase-js": "^2.102.1"
25
- }
23
+ "dependencies": {}
26
24
  }