ai-world-sdk 1.5.0 → 1.5.1

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.
@@ -20,11 +20,11 @@ function applyRootDebug(program) {
20
20
  }
21
21
  }
22
22
  function registerAuthCommands(program) {
23
- const auth = program.command('auth');
24
- auth
23
+ program
25
24
  .command('login')
26
- .option('--token <jwt>', 'JWT to store directly')
27
- .option('--timeout <ms>', 'OAuth timeout in milliseconds', (v) => parseInt(v, 10))
25
+ .description('登录 AI World(浏览器 OAuth 或直接设置 token)')
26
+ .option('--token <jwt>', '直接设置 JWT token')
27
+ .option('--timeout <ms>', 'OAuth 超时毫秒数', (v) => parseInt(v, 10))
28
28
  .action(async (opts) => {
29
29
  try {
30
30
  applyRootDebug(program);
@@ -54,10 +54,13 @@ function registerAuthCommands(program) {
54
54
  (0, output_1.output)({ ok: true, baseUrl: merged.baseUrl, pluginId: pluginId ?? merged.pluginId }, format);
55
55
  }
56
56
  catch (e) {
57
- (0, utils_1.handleError)(e, 'auth login');
57
+ (0, utils_1.handleError)(e, 'login');
58
58
  }
59
59
  });
60
- auth.command('logout').action(() => {
60
+ program
61
+ .command('logout')
62
+ .description('退出登录(清除缓存 token)')
63
+ .action(() => {
61
64
  try {
62
65
  const cfg = (0, config_2.readConfig)();
63
66
  delete cfg.token;
@@ -66,13 +69,17 @@ function registerAuthCommands(program) {
66
69
  (0, output_1.output)({ ok: true, loggedOut: true }, format);
67
70
  }
68
71
  catch (e) {
69
- (0, utils_1.handleError)(e, 'auth logout');
72
+ (0, utils_1.handleError)(e, 'logout');
70
73
  }
71
74
  });
72
- auth.command('me').action(async () => {
75
+ program
76
+ .command('me')
77
+ .description('查看当前用户信息')
78
+ .action(async () => {
73
79
  try {
74
80
  applyRootDebug(program);
75
81
  const merged = (0, config_2.resolveAuth)(program.opts());
82
+ resetSdkAuthState();
76
83
  (0, utils_1.initSDK)(merged);
77
84
  const client = new auth_1.AuthClient();
78
85
  const user = await client.getCurrentUserInfo();
@@ -80,10 +87,13 @@ function registerAuthCommands(program) {
80
87
  (0, output_1.output)(user, format);
81
88
  }
82
89
  catch (e) {
83
- (0, utils_1.handleError)(e, 'auth me');
90
+ (0, utils_1.handleError)(e, 'me');
84
91
  }
85
92
  });
86
- auth.command('status').action(async () => {
93
+ program
94
+ .command('status')
95
+ .description('检查认证状态')
96
+ .action(async () => {
87
97
  try {
88
98
  applyRootDebug(program);
89
99
  const merged = (0, config_2.resolveAuth)(program.opts());
@@ -104,7 +114,7 @@ function registerAuthCommands(program) {
104
114
  }
105
115
  }
106
116
  catch (e) {
107
- (0, utils_1.handleError)(e, 'auth status');
117
+ (0, utils_1.handleError)(e, 'status');
108
118
  }
109
119
  });
110
120
  }
package/dist/cli/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
4
5
  const commander_1 = require("commander");
5
6
  const utils_1 = require("./utils");
6
7
  const program = new commander_1.Command();
package/dist/config.d.ts CHANGED
@@ -9,7 +9,7 @@
9
9
  *
10
10
  * 注意: {VERSION} 占位符会在构建时被替换为实际版本号
11
11
  */
12
- export declare const SDK_SIGNATURE = "AI_WORLD_SDK_V:1.5.0";
12
+ export declare const SDK_SIGNATURE = "AI_WORLD_SDK_V:1.5.1";
13
13
  /**
14
14
  * 版本兼容性错误
15
15
  */
@@ -34,8 +34,8 @@ declare class SDKConfig {
34
34
  private _authenticated;
35
35
  private _authCheckPromise;
36
36
  private _currentUser;
37
- readonly sdkSignature = "AI_WORLD_SDK_V:1.5.0";
38
- readonly sdkVersion = "1.5.0";
37
+ readonly sdkSignature = "AI_WORLD_SDK_V:1.5.1";
38
+ readonly sdkVersion = "1.5.1";
39
39
  constructor();
40
40
  /**
41
41
  * Set global base URL
package/dist/config.js CHANGED
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.sdkConfig = exports.VersionCompatibilityError = exports.SDK_SIGNATURE = void 0;
8
8
  // SDK 版本号(构建时自动从 package.json 更新)
9
9
  // 此版本号会在运行 npm run build 时自动从 package.json 读取并更新
10
- const SDK_VERSION = "1.5.0";
10
+ const SDK_VERSION = "1.5.1";
11
11
  /**
12
12
  * SDK 特征码 - 用于在构建后的 JS 文件中识别 SDK 版本
13
13
  * 格式: AI_WORLD_SDK_V:版本号
@@ -15,7 +15,7 @@ const SDK_VERSION = "1.5.0";
15
15
  *
16
16
  * 注意: {VERSION} 占位符会在构建时被替换为实际版本号
17
17
  */
18
- exports.SDK_SIGNATURE = "AI_WORLD_SDK_V:1.5.0";
18
+ exports.SDK_SIGNATURE = "AI_WORLD_SDK_V:1.5.1";
19
19
  /**
20
20
  * 版本兼容性错误
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-world-sdk",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "TypeScript SDK for AI World Platform - Chat Models, Image Generation, and Video Generation",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",