@vatio-ai/cli 0.69.0 → 0.70.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 CHANGED
@@ -50,7 +50,7 @@ is no `--workspace` flag.
50
50
 
51
51
  ```
52
52
  init [SLUG] Create vatio.yml here, and the remote to match
53
- login | logout Authorize this machine in a browser, or forget it
53
+ login | logout Authorize this machine in a browser, or revoke and forget it
54
54
  doctor Node, config, workspace and token status
55
55
 
56
56
  push [--env NAME] Validate the workspace, then update a preview
package/bin/vatio.mjs CHANGED
@@ -64,7 +64,7 @@ async function run(command, args) {
64
64
  case "login":
65
65
  return await login(config, args);
66
66
  case "logout":
67
- return logout(config);
67
+ return await logout(config);
68
68
  case "config":
69
69
  return configCommand(config, args);
70
70
  case "init":
@@ -3,6 +3,9 @@
3
3
  import { DeniedError, DeviceAuthClient, ExpiredError, PendingError } from "../device-auth.mjs";
4
4
  import { DEFAULT_BASE_URL } from "../config.mjs";
5
5
  import { fail, openBrowser, sleep, takeValue } from "../support.mjs";
6
+ import { clientHeaders } from "../telemetry.mjs";
7
+
8
+ const LOGOUT_TIMEOUT_MS = 10_000;
6
9
 
7
10
  // A token is minted by a human signing in on the page this opens -- email,
8
11
  // Google or GitHub -- never by the CLI alone, which is why it asks nothing
@@ -85,7 +88,27 @@ export async function login(config, args) {
85
88
  console.log(`Token saved to ${config.configPath}`);
86
89
  }
87
90
 
88
- export function logout(config) {
91
+ // Revokes the saved token on the server before forgetting it, so a copy of
92
+ // the config file stops working too. Offline or already revoked, the local
93
+ // copy is still removed. A token in VATIO_TOKEN is left alone: it was never
94
+ // this file's to forget.
95
+ export async function logout(config) {
96
+ const token = config.load().token;
97
+ let revoked = false;
98
+ if (token) {
99
+ try {
100
+ const response = await fetch(`${config.resolveBaseUrl()}/api/developer/v1/session`, {
101
+ method: "DELETE",
102
+ headers: { ...clientHeaders(), Accept: "application/json", Authorization: `Bearer ${token}` },
103
+ signal: AbortSignal.timeout(LOGOUT_TIMEOUT_MS)
104
+ });
105
+ revoked = response.ok;
106
+ } catch {
107
+ revoked = false;
108
+ }
109
+ }
110
+
89
111
  config.clearToken();
90
112
  console.log(`Removed the token from ${config.configPath}`);
113
+ if (token && !revoked) console.log("Could not reach Vatio to revoke it; it expires 90 days after its last use.");
91
114
  }
package/lib/help.mjs CHANGED
@@ -21,7 +21,7 @@ and the one its pull request deploys to. Elsewhere commands default as listed.
21
21
  init [SLUG] [--name NAME] Create vatio.yml here, and the remote to match
22
22
  login [--base-url URL] Sign this machine in from the browser: email link,
23
23
  Google or GitHub. Creates the account if needed
24
- logout Forget the token
24
+ logout Revoke and forget the token
25
25
  doctor Node, config, workspace and token status
26
26
  version What this CLI is
27
27
  docs [--save [PATH]] The whole developer contract, live from Vatio
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vatio-ai/cli",
3
- "version": "0.69.0",
3
+ "version": "0.70.0",
4
4
  "description": "Vatio CLI — deploy and manage Vatio agent workspaces",
5
5
  "keywords": [
6
6
  "vatio",