@xuda.ai/cli 0.1.1 → 0.1.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.ai/cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Xuda CLI — sign in to Xuda and run published AI agents from your terminal.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/auth.mjs CHANGED
@@ -49,7 +49,17 @@ export const login = async () => {
49
49
  if (start.code < 0) throw new Error(`auth start failed: ${start.data}`);
50
50
  const { device_code, user_code, verification_uri, interval = 3, expires_in = 600 } = start.data;
51
51
 
52
- const fullUri = `${verification_uri}?code=${encodeURIComponent(user_code)}`;
52
+ let resolvedVerificationUri = verification_uri;
53
+ if (process.env.XUDA_WEB_URL) {
54
+ try {
55
+ const orig = new URL(verification_uri);
56
+ const override = new URL(process.env.XUDA_WEB_URL);
57
+ orig.protocol = override.protocol;
58
+ orig.host = override.host;
59
+ resolvedVerificationUri = orig.toString();
60
+ } catch {}
61
+ }
62
+ const fullUri = `${resolvedVerificationUri}?code=${encodeURIComponent(user_code)}`;
53
63
  console.log('');
54
64
  console.log(' Sign in to Xuda to continue.');
55
65
  console.log('');
package/src/config.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import os from 'node:os';
2
2
  import path from 'node:path';
3
3
 
4
- export const API_URL = process.env.XUDA_API_URL || 'https://api.xuda.io';
5
- export const WEB_URL = process.env.XUDA_WEB_URL || 'https://xuda.ai';
6
- export const WS_URL = (process.env.XUDA_WS_URL || API_URL).replace(/^http/, 'ws') + '/ws';
4
+ export const API_URL = process.env.XUDA_API_URL || 'https://xuda.ai';
5
+ export const WEB_URL = process.env.XUDA_WEB_URL || API_URL;
6
+ export const WS_URL = (process.env.XUDA_WS_URL || API_URL).replace(/^http/, 'ws');
7
7
 
8
8
  export const CRED_DIR = path.join(os.homedir(), '.xuda');
9
9
  export const CRED_FILE = path.join(CRED_DIR, 'credentials.json');
package/src/session.mjs CHANGED
@@ -2,7 +2,7 @@ import readline from 'node:readline';
2
2
  import { io } from 'socket.io-client';
3
3
  import { API_URL } from './config.mjs';
4
4
 
5
- const CLI_VERSION = '0.1.1';
5
+ const CLI_VERSION = '0.1.2';
6
6
 
7
7
  export const runAgentSession = async ({ agentId, agentName, agentVersion, credentials }) => {
8
8
  const socket = io(API_URL, {