seaverse-auth-sdk 0.1.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 +399 -0
- package/dist/index.cjs +2432 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +903 -0
- package/dist/index.js +2403 -0
- package/dist/index.js.map +1 -0
- package/package.json +64 -0
- package/src/auth-modal.css +944 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,903 @@
|
|
|
1
|
+
import { AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
2
|
+
|
|
3
|
+
type AuthType = 'apiKey' | 'oauth2' | 'jwt' | 'basic' | 'custom';
|
|
4
|
+
interface BaseCredentials {
|
|
5
|
+
type: AuthType;
|
|
6
|
+
}
|
|
7
|
+
interface ApiKeyCredentials extends BaseCredentials {
|
|
8
|
+
type: 'apiKey';
|
|
9
|
+
apiKey: string;
|
|
10
|
+
location: 'header' | 'query';
|
|
11
|
+
name: string;
|
|
12
|
+
}
|
|
13
|
+
interface OAuth2Credentials extends BaseCredentials {
|
|
14
|
+
type: 'oauth2';
|
|
15
|
+
clientId: string;
|
|
16
|
+
clientSecret: string;
|
|
17
|
+
tokenUrl: string;
|
|
18
|
+
accessToken?: string;
|
|
19
|
+
refreshToken?: string;
|
|
20
|
+
expiresAt?: number;
|
|
21
|
+
scope?: string;
|
|
22
|
+
}
|
|
23
|
+
interface JWTCredentials extends BaseCredentials {
|
|
24
|
+
type: 'jwt';
|
|
25
|
+
token: string;
|
|
26
|
+
headerName?: string;
|
|
27
|
+
}
|
|
28
|
+
interface BasicAuthCredentials extends BaseCredentials {
|
|
29
|
+
type: 'basic';
|
|
30
|
+
username: string;
|
|
31
|
+
password: string;
|
|
32
|
+
}
|
|
33
|
+
interface CustomAuthCredentials extends BaseCredentials {
|
|
34
|
+
type: 'custom';
|
|
35
|
+
handler: (config: AxiosRequestConfig) => Promise<AxiosRequestConfig>;
|
|
36
|
+
}
|
|
37
|
+
type Credentials = ApiKeyCredentials | OAuth2Credentials | JWTCredentials | BasicAuthCredentials | CustomAuthCredentials;
|
|
38
|
+
interface AuthConfig {
|
|
39
|
+
type: AuthType;
|
|
40
|
+
credentials: Credentials;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* 认证提供者抽象基类
|
|
45
|
+
*/
|
|
46
|
+
declare abstract class AuthProvider {
|
|
47
|
+
protected credentials: Credentials;
|
|
48
|
+
constructor(credentials: Credentials);
|
|
49
|
+
/**
|
|
50
|
+
* 将认证信息附加到请求配置
|
|
51
|
+
* @param config Axios请求配置
|
|
52
|
+
* @returns 附加认证信息后的请求配置
|
|
53
|
+
*/
|
|
54
|
+
abstract attachCredentials(config: AxiosRequestConfig): Promise<AxiosRequestConfig>;
|
|
55
|
+
/**
|
|
56
|
+
* 刷新凭证(如token)
|
|
57
|
+
*/
|
|
58
|
+
abstract refreshCredentials(): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* 验证凭证是否有效
|
|
61
|
+
*/
|
|
62
|
+
abstract isValid(): Promise<boolean>;
|
|
63
|
+
/**
|
|
64
|
+
* 获取当前凭证
|
|
65
|
+
*/
|
|
66
|
+
getCredentials(): Credentials;
|
|
67
|
+
/**
|
|
68
|
+
* 更新凭证
|
|
69
|
+
*/
|
|
70
|
+
updateCredentials(credentials: Partial<Credentials>): void;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* 认证提供者工厂
|
|
75
|
+
*/
|
|
76
|
+
declare class AuthFactory {
|
|
77
|
+
/**
|
|
78
|
+
* 根据配置创建认证提供者
|
|
79
|
+
*/
|
|
80
|
+
static create(config: AuthConfig): AuthProvider;
|
|
81
|
+
/**
|
|
82
|
+
* 根据凭证创建认证提供者
|
|
83
|
+
*/
|
|
84
|
+
static createFromCredentials(credentials: Credentials): AuthProvider;
|
|
85
|
+
/**
|
|
86
|
+
* 从环境变量创建认证提供者
|
|
87
|
+
*/
|
|
88
|
+
static fromEnv(): AuthProvider;
|
|
89
|
+
/**
|
|
90
|
+
* 从配置文件创建认证提供者
|
|
91
|
+
*/
|
|
92
|
+
static fromFile(path: string): Promise<AuthProvider>;
|
|
93
|
+
/**
|
|
94
|
+
* 从profile创建认证提供者
|
|
95
|
+
*/
|
|
96
|
+
static fromProfile(profileName?: string): Promise<AuthProvider>;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
type HookType = 'beforeRequest' | 'afterResponse' | 'onError' | 'onRetry';
|
|
100
|
+
interface HookContext {
|
|
101
|
+
operationId: string;
|
|
102
|
+
config: AxiosRequestConfig;
|
|
103
|
+
response?: AxiosResponse;
|
|
104
|
+
error?: any;
|
|
105
|
+
retryCount?: number;
|
|
106
|
+
metadata?: Record<string, any>;
|
|
107
|
+
}
|
|
108
|
+
type HookFunction = (context: HookContext) => Promise<void> | void;
|
|
109
|
+
interface HookFilter {
|
|
110
|
+
operationIds?: string[];
|
|
111
|
+
methods?: string[];
|
|
112
|
+
pathPatterns?: RegExp[];
|
|
113
|
+
}
|
|
114
|
+
interface Hook {
|
|
115
|
+
type: HookType;
|
|
116
|
+
name: string;
|
|
117
|
+
priority: number;
|
|
118
|
+
handler: HookFunction;
|
|
119
|
+
filter?: HookFilter;
|
|
120
|
+
}
|
|
121
|
+
interface HookManagerOptions {
|
|
122
|
+
hooks?: Hook[];
|
|
123
|
+
enableBuiltInHooks?: {
|
|
124
|
+
logger?: boolean;
|
|
125
|
+
requestId?: boolean;
|
|
126
|
+
retry?: boolean;
|
|
127
|
+
rateLimit?: boolean;
|
|
128
|
+
cache?: boolean;
|
|
129
|
+
metrics?: boolean;
|
|
130
|
+
};
|
|
131
|
+
loggerOptions?: LoggerOptions;
|
|
132
|
+
retryOptions?: RetryOptions;
|
|
133
|
+
rateLimitOptions?: RateLimitOptions;
|
|
134
|
+
cacheOptions?: CacheOptions;
|
|
135
|
+
metricsOptions?: MetricsOptions;
|
|
136
|
+
}
|
|
137
|
+
interface LoggerOptions {
|
|
138
|
+
logLevel?: 'debug' | 'info' | 'warn' | 'error';
|
|
139
|
+
logRequestBody?: boolean;
|
|
140
|
+
logResponseBody?: boolean;
|
|
141
|
+
logHeaders?: boolean;
|
|
142
|
+
}
|
|
143
|
+
interface RetryOptions {
|
|
144
|
+
maxRetries?: number;
|
|
145
|
+
retryDelay?: number;
|
|
146
|
+
retryStatusCodes?: number[];
|
|
147
|
+
backoffMultiplier?: number;
|
|
148
|
+
}
|
|
149
|
+
interface RateLimitOptions {
|
|
150
|
+
requestsPerSecond?: number;
|
|
151
|
+
requestsPerMinute?: number;
|
|
152
|
+
}
|
|
153
|
+
interface CacheOptions {
|
|
154
|
+
ttl?: number;
|
|
155
|
+
maxSize?: number;
|
|
156
|
+
methods?: string[];
|
|
157
|
+
}
|
|
158
|
+
interface MetricsOptions {
|
|
159
|
+
enabled?: boolean;
|
|
160
|
+
collector?: (metrics: RequestMetrics) => void;
|
|
161
|
+
}
|
|
162
|
+
interface RequestMetrics {
|
|
163
|
+
operationId: string;
|
|
164
|
+
method: string;
|
|
165
|
+
path: string;
|
|
166
|
+
statusCode?: number;
|
|
167
|
+
duration: number;
|
|
168
|
+
timestamp: number;
|
|
169
|
+
error?: string;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* 内置Hook集合
|
|
174
|
+
*/
|
|
175
|
+
declare class BuiltInHooks {
|
|
176
|
+
/**
|
|
177
|
+
* 创建日志记录Hook
|
|
178
|
+
*/
|
|
179
|
+
static createLoggerHook(options?: LoggerOptions): Hook;
|
|
180
|
+
/**
|
|
181
|
+
* 创建请求ID Hook
|
|
182
|
+
*/
|
|
183
|
+
static createRequestIdHook(): Hook;
|
|
184
|
+
/**
|
|
185
|
+
* 创建速率限制Hook
|
|
186
|
+
*/
|
|
187
|
+
static createRateLimitHook(options?: RateLimitOptions): Hook;
|
|
188
|
+
/**
|
|
189
|
+
* 创建缓存Hook(简化版)
|
|
190
|
+
*/
|
|
191
|
+
static createCacheHook(options?: CacheOptions): Hook;
|
|
192
|
+
/**
|
|
193
|
+
* 创建性能监控Hook
|
|
194
|
+
*/
|
|
195
|
+
static createMetricsHook(options?: MetricsOptions): Hook;
|
|
196
|
+
/**
|
|
197
|
+
* 创建重试Hook(需要在interceptor中实现真正的重试逻辑)
|
|
198
|
+
*/
|
|
199
|
+
static createRetryHook(maxRetries?: number, retryDelay?: number): Hook;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Type definitions for SeaVerse Dispatcher API
|
|
204
|
+
* Generated from auth.yaml OpenAPI specification
|
|
205
|
+
*/
|
|
206
|
+
/**
|
|
207
|
+
* User model
|
|
208
|
+
*/
|
|
209
|
+
interface User {
|
|
210
|
+
id?: string;
|
|
211
|
+
email?: string;
|
|
212
|
+
username?: string;
|
|
213
|
+
createdAt?: number;
|
|
214
|
+
emailVerified?: boolean;
|
|
215
|
+
googleId?: string;
|
|
216
|
+
discordId?: string;
|
|
217
|
+
githubId?: string;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Login request payload
|
|
221
|
+
*/
|
|
222
|
+
interface LoginRequest {
|
|
223
|
+
email: string;
|
|
224
|
+
password: string;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Login response
|
|
228
|
+
*/
|
|
229
|
+
interface LoginResponse {
|
|
230
|
+
token: string;
|
|
231
|
+
user: User;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Register request payload
|
|
235
|
+
*/
|
|
236
|
+
interface RegisterRequest {
|
|
237
|
+
email: string;
|
|
238
|
+
password: string;
|
|
239
|
+
invitationCode?: string;
|
|
240
|
+
fromShareAppId?: string;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Register response
|
|
244
|
+
*/
|
|
245
|
+
interface RegisterResponse {
|
|
246
|
+
success: boolean;
|
|
247
|
+
message: string;
|
|
248
|
+
userId: string;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Forgot password request
|
|
252
|
+
*/
|
|
253
|
+
interface ForgotPasswordRequest {
|
|
254
|
+
email: string;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Reset password request
|
|
258
|
+
*/
|
|
259
|
+
interface ResetPasswordRequest {
|
|
260
|
+
token: string;
|
|
261
|
+
newPassword: string;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* OAuth code exchange request
|
|
265
|
+
*/
|
|
266
|
+
interface CodeToTokenRequest {
|
|
267
|
+
code: string;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* OAuth code exchange response
|
|
271
|
+
*/
|
|
272
|
+
interface CodeToTokenResponse {
|
|
273
|
+
token: string;
|
|
274
|
+
user: User;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Health check response
|
|
278
|
+
*/
|
|
279
|
+
interface HealthResponse {
|
|
280
|
+
status: string;
|
|
281
|
+
service: string;
|
|
282
|
+
timestamp: number;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* API service token response
|
|
286
|
+
*/
|
|
287
|
+
interface ApiServiceTokenResponse {
|
|
288
|
+
token: string;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Container model
|
|
292
|
+
*/
|
|
293
|
+
interface Container {
|
|
294
|
+
id: string;
|
|
295
|
+
status: 'healthy' | 'unhealthy' | 'disconnected';
|
|
296
|
+
backendUrl: string;
|
|
297
|
+
activeConnections: number;
|
|
298
|
+
maxConnections: number;
|
|
299
|
+
registeredAt: number;
|
|
300
|
+
lastHeartbeat: number;
|
|
301
|
+
metadata?: Record<string, any>;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Register container request
|
|
305
|
+
*/
|
|
306
|
+
interface RegisterContainerRequest {
|
|
307
|
+
id: string;
|
|
308
|
+
backendUrl: string;
|
|
309
|
+
maxConnections?: number;
|
|
310
|
+
metadata?: Record<string, any>;
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Register container response
|
|
314
|
+
*/
|
|
315
|
+
interface RegisterContainerResponse {
|
|
316
|
+
success: boolean;
|
|
317
|
+
container: Container;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Container list response
|
|
321
|
+
*/
|
|
322
|
+
interface ContainerListResponse {
|
|
323
|
+
containers: Container[];
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Container detail response
|
|
327
|
+
*/
|
|
328
|
+
interface ContainerDetailResponse {
|
|
329
|
+
container: Container;
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Container stats response
|
|
333
|
+
*/
|
|
334
|
+
interface ContainerStatsResponse {
|
|
335
|
+
totalContainers: number;
|
|
336
|
+
healthyContainers: number;
|
|
337
|
+
totalConnections: number;
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Conversation status
|
|
341
|
+
*/
|
|
342
|
+
interface ConversationStatus {
|
|
343
|
+
conversation_id: string;
|
|
344
|
+
is_processing: boolean;
|
|
345
|
+
last_message_at: number | null;
|
|
346
|
+
last_stream_id: string | null;
|
|
347
|
+
backend_ws_id: string | null;
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Invite code generate response
|
|
351
|
+
*/
|
|
352
|
+
interface InviteCodeGenerateResponse {
|
|
353
|
+
code: string;
|
|
354
|
+
expiresAt: number;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Invite code verify response
|
|
358
|
+
*/
|
|
359
|
+
interface InviteCodeVerifyResponse {
|
|
360
|
+
valid: boolean;
|
|
361
|
+
code: string;
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Invite code bind request
|
|
365
|
+
*/
|
|
366
|
+
interface InviteCodeBindRequest {
|
|
367
|
+
code: string;
|
|
368
|
+
userId: string;
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Invite application
|
|
372
|
+
*/
|
|
373
|
+
interface InviteApplication {
|
|
374
|
+
id: string;
|
|
375
|
+
email: string;
|
|
376
|
+
reason: string;
|
|
377
|
+
status: 'pending' | 'approved' | 'rejected';
|
|
378
|
+
createdAt: number;
|
|
379
|
+
reviewedAt: number | null;
|
|
380
|
+
inviteCode: string | null;
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Submit invite application request
|
|
384
|
+
*/
|
|
385
|
+
interface SubmitInviteApplicationRequest {
|
|
386
|
+
email: string;
|
|
387
|
+
reason: string;
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Invite application list response
|
|
391
|
+
*/
|
|
392
|
+
interface InviteApplicationListResponse {
|
|
393
|
+
applications: InviteApplication[];
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Marketplace skill
|
|
397
|
+
*/
|
|
398
|
+
interface MarketplaceSkill {
|
|
399
|
+
id: string;
|
|
400
|
+
name: string;
|
|
401
|
+
title: string;
|
|
402
|
+
description: string;
|
|
403
|
+
category: string;
|
|
404
|
+
tags: string[];
|
|
405
|
+
authorId: string;
|
|
406
|
+
version: string;
|
|
407
|
+
downloads: number;
|
|
408
|
+
stars: number;
|
|
409
|
+
status: 'draft' | 'published' | 'archived';
|
|
410
|
+
featured: boolean;
|
|
411
|
+
createdAt: number;
|
|
412
|
+
updatedAt: number;
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Create marketplace skill request
|
|
416
|
+
*/
|
|
417
|
+
interface CreateMarketplaceSkillRequest {
|
|
418
|
+
name: string;
|
|
419
|
+
title: string;
|
|
420
|
+
description: string;
|
|
421
|
+
category: string;
|
|
422
|
+
tags?: string[];
|
|
423
|
+
version?: string;
|
|
424
|
+
featured?: boolean;
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Marketplace skills list response
|
|
428
|
+
*/
|
|
429
|
+
interface MarketplaceSkillsListResponse {
|
|
430
|
+
skills: MarketplaceSkill[];
|
|
431
|
+
lastKey?: string;
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* User installed skill
|
|
435
|
+
*/
|
|
436
|
+
interface UserInstalledSkill {
|
|
437
|
+
name: string;
|
|
438
|
+
marketplaceId: string;
|
|
439
|
+
version: string;
|
|
440
|
+
installedAt: number;
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* User installed skills list response
|
|
444
|
+
*/
|
|
445
|
+
interface UserInstalledSkillsListResponse {
|
|
446
|
+
skills: UserInstalledSkill[];
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* Publish skill to marketplace request
|
|
450
|
+
*/
|
|
451
|
+
interface PublishSkillRequest {
|
|
452
|
+
name: string;
|
|
453
|
+
title: string;
|
|
454
|
+
description: string;
|
|
455
|
+
category: string;
|
|
456
|
+
tags?: string[];
|
|
457
|
+
version?: string;
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Hub project
|
|
461
|
+
*/
|
|
462
|
+
interface HubProject {
|
|
463
|
+
id: string;
|
|
464
|
+
name: string;
|
|
465
|
+
description: string;
|
|
466
|
+
appId: string;
|
|
467
|
+
authorId: string;
|
|
468
|
+
tags: string[];
|
|
469
|
+
coverUrl: string;
|
|
470
|
+
visibility: 'public' | 'private';
|
|
471
|
+
forkCount: number;
|
|
472
|
+
createdAt: number;
|
|
473
|
+
updatedAt: number;
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Publish project to hub request
|
|
477
|
+
*/
|
|
478
|
+
interface PublishProjectRequest {
|
|
479
|
+
appId: string;
|
|
480
|
+
name: string;
|
|
481
|
+
description?: string;
|
|
482
|
+
tags?: string[];
|
|
483
|
+
coverUrl?: string;
|
|
484
|
+
visibility?: 'public' | 'private';
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* Fork project request
|
|
488
|
+
*/
|
|
489
|
+
interface ForkProjectRequest {
|
|
490
|
+
projectId: string;
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* Fork project response
|
|
494
|
+
*/
|
|
495
|
+
interface ForkProjectResponse {
|
|
496
|
+
success: boolean;
|
|
497
|
+
appId: string;
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* Hub projects list response
|
|
501
|
+
*/
|
|
502
|
+
interface HubProjectsListResponse {
|
|
503
|
+
projects: HubProject[];
|
|
504
|
+
cursor?: string;
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* Track app type request
|
|
508
|
+
*/
|
|
509
|
+
interface TrackAppTypeRequest {
|
|
510
|
+
appId: string;
|
|
511
|
+
appType: string;
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* Social media link
|
|
515
|
+
*/
|
|
516
|
+
interface SocialMediaLink {
|
|
517
|
+
id: string;
|
|
518
|
+
name: string;
|
|
519
|
+
url: string;
|
|
520
|
+
icon: string;
|
|
521
|
+
enabled: boolean;
|
|
522
|
+
order: number;
|
|
523
|
+
}
|
|
524
|
+
/**
|
|
525
|
+
* Social media links response
|
|
526
|
+
*/
|
|
527
|
+
interface SocialMediaLinksResponse {
|
|
528
|
+
links: SocialMediaLink[];
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Speech token response
|
|
532
|
+
*/
|
|
533
|
+
interface SpeechTokenResponse {
|
|
534
|
+
success: boolean;
|
|
535
|
+
authToken: string;
|
|
536
|
+
region: string;
|
|
537
|
+
autoDetectLanguage: boolean;
|
|
538
|
+
candidateLanguages: string[];
|
|
539
|
+
expiresIn: number;
|
|
540
|
+
maxDuration: number;
|
|
541
|
+
timestamp: number;
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Create video share request
|
|
545
|
+
*/
|
|
546
|
+
interface CreateVideoShareRequest {
|
|
547
|
+
assetId: string;
|
|
548
|
+
title: string;
|
|
549
|
+
videoUrl: string;
|
|
550
|
+
thumbnailUrl?: string;
|
|
551
|
+
expiryDays?: number;
|
|
552
|
+
}
|
|
553
|
+
/**
|
|
554
|
+
* Create video share response
|
|
555
|
+
*/
|
|
556
|
+
interface CreateVideoShareResponse {
|
|
557
|
+
videoId: string;
|
|
558
|
+
shareUrl: string;
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* Video details
|
|
562
|
+
*/
|
|
563
|
+
interface VideoDetails {
|
|
564
|
+
videoId: string;
|
|
565
|
+
title: string;
|
|
566
|
+
videoUrl: string;
|
|
567
|
+
thumbnailUrl?: string;
|
|
568
|
+
createdAt: number;
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* API error response
|
|
572
|
+
*/
|
|
573
|
+
interface ApiError {
|
|
574
|
+
error: string;
|
|
575
|
+
code: string;
|
|
576
|
+
details?: Record<string, any>;
|
|
577
|
+
}
|
|
578
|
+
/**
|
|
579
|
+
* Standard success response
|
|
580
|
+
*/
|
|
581
|
+
interface SuccessResponse {
|
|
582
|
+
success: boolean;
|
|
583
|
+
message?: string;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
type models_ApiError = ApiError;
|
|
587
|
+
type models_ApiServiceTokenResponse = ApiServiceTokenResponse;
|
|
588
|
+
type models_CodeToTokenRequest = CodeToTokenRequest;
|
|
589
|
+
type models_CodeToTokenResponse = CodeToTokenResponse;
|
|
590
|
+
type models_Container = Container;
|
|
591
|
+
type models_ContainerDetailResponse = ContainerDetailResponse;
|
|
592
|
+
type models_ContainerListResponse = ContainerListResponse;
|
|
593
|
+
type models_ContainerStatsResponse = ContainerStatsResponse;
|
|
594
|
+
type models_ConversationStatus = ConversationStatus;
|
|
595
|
+
type models_CreateMarketplaceSkillRequest = CreateMarketplaceSkillRequest;
|
|
596
|
+
type models_CreateVideoShareRequest = CreateVideoShareRequest;
|
|
597
|
+
type models_CreateVideoShareResponse = CreateVideoShareResponse;
|
|
598
|
+
type models_ForgotPasswordRequest = ForgotPasswordRequest;
|
|
599
|
+
type models_ForkProjectRequest = ForkProjectRequest;
|
|
600
|
+
type models_ForkProjectResponse = ForkProjectResponse;
|
|
601
|
+
type models_HealthResponse = HealthResponse;
|
|
602
|
+
type models_HubProject = HubProject;
|
|
603
|
+
type models_HubProjectsListResponse = HubProjectsListResponse;
|
|
604
|
+
type models_InviteApplication = InviteApplication;
|
|
605
|
+
type models_InviteApplicationListResponse = InviteApplicationListResponse;
|
|
606
|
+
type models_InviteCodeBindRequest = InviteCodeBindRequest;
|
|
607
|
+
type models_InviteCodeGenerateResponse = InviteCodeGenerateResponse;
|
|
608
|
+
type models_InviteCodeVerifyResponse = InviteCodeVerifyResponse;
|
|
609
|
+
type models_LoginRequest = LoginRequest;
|
|
610
|
+
type models_LoginResponse = LoginResponse;
|
|
611
|
+
type models_MarketplaceSkill = MarketplaceSkill;
|
|
612
|
+
type models_MarketplaceSkillsListResponse = MarketplaceSkillsListResponse;
|
|
613
|
+
type models_PublishProjectRequest = PublishProjectRequest;
|
|
614
|
+
type models_PublishSkillRequest = PublishSkillRequest;
|
|
615
|
+
type models_RegisterContainerRequest = RegisterContainerRequest;
|
|
616
|
+
type models_RegisterContainerResponse = RegisterContainerResponse;
|
|
617
|
+
type models_RegisterRequest = RegisterRequest;
|
|
618
|
+
type models_RegisterResponse = RegisterResponse;
|
|
619
|
+
type models_ResetPasswordRequest = ResetPasswordRequest;
|
|
620
|
+
type models_SocialMediaLink = SocialMediaLink;
|
|
621
|
+
type models_SocialMediaLinksResponse = SocialMediaLinksResponse;
|
|
622
|
+
type models_SpeechTokenResponse = SpeechTokenResponse;
|
|
623
|
+
type models_SubmitInviteApplicationRequest = SubmitInviteApplicationRequest;
|
|
624
|
+
type models_SuccessResponse = SuccessResponse;
|
|
625
|
+
type models_TrackAppTypeRequest = TrackAppTypeRequest;
|
|
626
|
+
type models_User = User;
|
|
627
|
+
type models_UserInstalledSkill = UserInstalledSkill;
|
|
628
|
+
type models_UserInstalledSkillsListResponse = UserInstalledSkillsListResponse;
|
|
629
|
+
type models_VideoDetails = VideoDetails;
|
|
630
|
+
declare namespace models {
|
|
631
|
+
export type { models_ApiError as ApiError, models_ApiServiceTokenResponse as ApiServiceTokenResponse, models_CodeToTokenRequest as CodeToTokenRequest, models_CodeToTokenResponse as CodeToTokenResponse, models_Container as Container, models_ContainerDetailResponse as ContainerDetailResponse, models_ContainerListResponse as ContainerListResponse, models_ContainerStatsResponse as ContainerStatsResponse, models_ConversationStatus as ConversationStatus, models_CreateMarketplaceSkillRequest as CreateMarketplaceSkillRequest, models_CreateVideoShareRequest as CreateVideoShareRequest, models_CreateVideoShareResponse as CreateVideoShareResponse, models_ForgotPasswordRequest as ForgotPasswordRequest, models_ForkProjectRequest as ForkProjectRequest, models_ForkProjectResponse as ForkProjectResponse, models_HealthResponse as HealthResponse, models_HubProject as HubProject, models_HubProjectsListResponse as HubProjectsListResponse, models_InviteApplication as InviteApplication, models_InviteApplicationListResponse as InviteApplicationListResponse, models_InviteCodeBindRequest as InviteCodeBindRequest, models_InviteCodeGenerateResponse as InviteCodeGenerateResponse, models_InviteCodeVerifyResponse as InviteCodeVerifyResponse, models_LoginRequest as LoginRequest, models_LoginResponse as LoginResponse, models_MarketplaceSkill as MarketplaceSkill, models_MarketplaceSkillsListResponse as MarketplaceSkillsListResponse, models_PublishProjectRequest as PublishProjectRequest, models_PublishSkillRequest as PublishSkillRequest, models_RegisterContainerRequest as RegisterContainerRequest, models_RegisterContainerResponse as RegisterContainerResponse, models_RegisterRequest as RegisterRequest, models_RegisterResponse as RegisterResponse, models_ResetPasswordRequest as ResetPasswordRequest, models_SocialMediaLink as SocialMediaLink, models_SocialMediaLinksResponse as SocialMediaLinksResponse, models_SpeechTokenResponse as SpeechTokenResponse, models_SubmitInviteApplicationRequest as SubmitInviteApplicationRequest, models_SuccessResponse as SuccessResponse, models_TrackAppTypeRequest as TrackAppTypeRequest, models_User as User, models_UserInstalledSkill as UserInstalledSkill, models_UserInstalledSkillsListResponse as UserInstalledSkillsListResponse, models_VideoDetails as VideoDetails };
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
interface SeaVerseBackendAPIClientOptions {
|
|
635
|
+
baseURL?: string;
|
|
636
|
+
timeout?: number;
|
|
637
|
+
headers?: Record<string, string>;
|
|
638
|
+
auth?: AuthProvider;
|
|
639
|
+
hooks?: HookManagerOptions;
|
|
640
|
+
}
|
|
641
|
+
/**
|
|
642
|
+
* SeaVerse Backend API Client
|
|
643
|
+
* SeaVerse Dispatcher API - 云原生 AI Agent 平台的统一网关服务
|
|
644
|
+
* @version 2.0.0
|
|
645
|
+
*/
|
|
646
|
+
declare class SeaVerseBackendAPIClient {
|
|
647
|
+
private httpClient;
|
|
648
|
+
constructor(options?: SeaVerseBackendAPIClientOptions);
|
|
649
|
+
/**
|
|
650
|
+
* Get default authentication configuration
|
|
651
|
+
*/
|
|
652
|
+
private getDefaultAuth;
|
|
653
|
+
/**
|
|
654
|
+
* Get default hooks configuration
|
|
655
|
+
*/
|
|
656
|
+
private getDefaultHooks;
|
|
657
|
+
/**
|
|
658
|
+
* Health check
|
|
659
|
+
* Check if the service is healthy
|
|
660
|
+
*/
|
|
661
|
+
getHealth(options?: AxiosRequestConfig): Promise<HealthResponse>;
|
|
662
|
+
/**
|
|
663
|
+
* User registration
|
|
664
|
+
* Register a new user with email verification
|
|
665
|
+
*/
|
|
666
|
+
register(data: RegisterRequest, options?: AxiosRequestConfig): Promise<RegisterResponse>;
|
|
667
|
+
/**
|
|
668
|
+
* User login
|
|
669
|
+
* Login with email and password
|
|
670
|
+
*/
|
|
671
|
+
login(data: LoginRequest, options?: AxiosRequestConfig): Promise<LoginResponse>;
|
|
672
|
+
/**
|
|
673
|
+
* Get current user
|
|
674
|
+
* Get the authenticated user's information
|
|
675
|
+
*/
|
|
676
|
+
getCurrentUser(options?: AxiosRequestConfig): Promise<User>;
|
|
677
|
+
/**
|
|
678
|
+
* User logout
|
|
679
|
+
* Logout the current user
|
|
680
|
+
*/
|
|
681
|
+
logout(options?: AxiosRequestConfig): Promise<SuccessResponse>;
|
|
682
|
+
/**
|
|
683
|
+
* Request password reset
|
|
684
|
+
* Send password reset email
|
|
685
|
+
*/
|
|
686
|
+
forgotPassword(data: ForgotPasswordRequest, options?: AxiosRequestConfig): Promise<SuccessResponse>;
|
|
687
|
+
/**
|
|
688
|
+
* Reset password
|
|
689
|
+
* Reset password with token from email
|
|
690
|
+
*/
|
|
691
|
+
resetPassword(data: ResetPasswordRequest, options?: AxiosRequestConfig): Promise<SuccessResponse>;
|
|
692
|
+
/**
|
|
693
|
+
* Get api-service token
|
|
694
|
+
* Generate token for accessing api-service from sandbox
|
|
695
|
+
*/
|
|
696
|
+
getApiServiceToken(options?: AxiosRequestConfig): Promise<ApiServiceTokenResponse>;
|
|
697
|
+
/**
|
|
698
|
+
* Exchange Google code for token
|
|
699
|
+
* Exchange Google authorization code for JWT token (for app)
|
|
700
|
+
*/
|
|
701
|
+
googleCodeToToken(data: CodeToTokenRequest, options?: AxiosRequestConfig): Promise<CodeToTokenResponse>;
|
|
702
|
+
/**
|
|
703
|
+
* Unlink Google account
|
|
704
|
+
* Unlink the user's Google account
|
|
705
|
+
*/
|
|
706
|
+
unlinkGoogle(options?: AxiosRequestConfig): Promise<SuccessResponse>;
|
|
707
|
+
/**
|
|
708
|
+
* Exchange Discord code for token
|
|
709
|
+
*/
|
|
710
|
+
discordCodeToToken(data: CodeToTokenRequest, options?: AxiosRequestConfig): Promise<CodeToTokenResponse>;
|
|
711
|
+
/**
|
|
712
|
+
* Unlink Discord account
|
|
713
|
+
*/
|
|
714
|
+
unlinkDiscord(options?: AxiosRequestConfig): Promise<SuccessResponse>;
|
|
715
|
+
/**
|
|
716
|
+
* Exchange GitHub code for token
|
|
717
|
+
*/
|
|
718
|
+
githubCodeToToken(data: CodeToTokenRequest, options?: AxiosRequestConfig): Promise<CodeToTokenResponse>;
|
|
719
|
+
/**
|
|
720
|
+
* Unlink GitHub account
|
|
721
|
+
*/
|
|
722
|
+
unlinkGithub(options?: AxiosRequestConfig): Promise<SuccessResponse>;
|
|
723
|
+
/**
|
|
724
|
+
* List all containers
|
|
725
|
+
*/
|
|
726
|
+
listContainers(options?: AxiosRequestConfig): Promise<ContainerListResponse>;
|
|
727
|
+
/**
|
|
728
|
+
* Register a container
|
|
729
|
+
* Internal service call to register a new container
|
|
730
|
+
*/
|
|
731
|
+
registerContainer(data: RegisterContainerRequest, options?: AxiosRequestConfig): Promise<RegisterContainerResponse>;
|
|
732
|
+
/**
|
|
733
|
+
* Get container by ID
|
|
734
|
+
*/
|
|
735
|
+
getContainer(id: string, options?: AxiosRequestConfig): Promise<ContainerDetailResponse>;
|
|
736
|
+
/**
|
|
737
|
+
* Unregister a container
|
|
738
|
+
* Internal service call to unregister a container
|
|
739
|
+
*/
|
|
740
|
+
unregisterContainer(id: string, options?: AxiosRequestConfig): Promise<SuccessResponse>;
|
|
741
|
+
/**
|
|
742
|
+
* Get container statistics
|
|
743
|
+
*/
|
|
744
|
+
getContainerStats(options?: AxiosRequestConfig): Promise<ContainerStatsResponse>;
|
|
745
|
+
/**
|
|
746
|
+
* Container heartbeat
|
|
747
|
+
* Internal service call to update container heartbeat
|
|
748
|
+
*/
|
|
749
|
+
containerHeartbeat(id: string, options?: AxiosRequestConfig): Promise<SuccessResponse>;
|
|
750
|
+
/**
|
|
751
|
+
* Get conversation status
|
|
752
|
+
* Query conversation streaming status from Redis
|
|
753
|
+
*/
|
|
754
|
+
getConversationStatus(conversationId: string, options?: AxiosRequestConfig): Promise<ConversationStatus>;
|
|
755
|
+
/**
|
|
756
|
+
* List marketplace skills
|
|
757
|
+
*/
|
|
758
|
+
listMarketplaceSkills(params?: {
|
|
759
|
+
category?: string;
|
|
760
|
+
status?: 'draft' | 'published' | 'archived';
|
|
761
|
+
authorId?: string;
|
|
762
|
+
featured?: boolean;
|
|
763
|
+
limit?: number;
|
|
764
|
+
lastKey?: string;
|
|
765
|
+
}, options?: AxiosRequestConfig): Promise<MarketplaceSkillsListResponse>;
|
|
766
|
+
/**
|
|
767
|
+
* Get skill details
|
|
768
|
+
*/
|
|
769
|
+
getMarketplaceSkill(skillId: string, options?: AxiosRequestConfig): Promise<MarketplaceSkill>;
|
|
770
|
+
/**
|
|
771
|
+
* Install skill from marketplace
|
|
772
|
+
*/
|
|
773
|
+
installSkill(skillId: string, options?: AxiosRequestConfig): Promise<SuccessResponse>;
|
|
774
|
+
/**
|
|
775
|
+
* List user installed skills
|
|
776
|
+
*/
|
|
777
|
+
listUserSkills(options?: AxiosRequestConfig): Promise<UserInstalledSkillsListResponse>;
|
|
778
|
+
/**
|
|
779
|
+
* Uninstall skill
|
|
780
|
+
*/
|
|
781
|
+
uninstallSkill(localName: string, options?: AxiosRequestConfig): Promise<void>;
|
|
782
|
+
/**
|
|
783
|
+
* Get Azure Speech token
|
|
784
|
+
* Get temporary token for Azure Speech Service
|
|
785
|
+
*/
|
|
786
|
+
getSpeechToken(options?: AxiosRequestConfig): Promise<SpeechTokenResponse>;
|
|
787
|
+
/**
|
|
788
|
+
* @deprecated Use register() instead
|
|
789
|
+
*/
|
|
790
|
+
postapiauthregister(data: any, options?: AxiosRequestConfig): Promise<any>;
|
|
791
|
+
/**
|
|
792
|
+
* @deprecated Use login() instead
|
|
793
|
+
*/
|
|
794
|
+
postapiauthlogin(data: any, options?: AxiosRequestConfig): Promise<any>;
|
|
795
|
+
/**
|
|
796
|
+
* @deprecated Use getHealth() instead
|
|
797
|
+
*/
|
|
798
|
+
gethealth(options?: AxiosRequestConfig): Promise<any>;
|
|
799
|
+
/**
|
|
800
|
+
* @deprecated Use listContainers() instead
|
|
801
|
+
*/
|
|
802
|
+
getapicontainers(options?: AxiosRequestConfig): Promise<any>;
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
interface OAuthConfig {
|
|
806
|
+
google?: {
|
|
807
|
+
clientId: string;
|
|
808
|
+
redirectUri: string;
|
|
809
|
+
scope?: string;
|
|
810
|
+
};
|
|
811
|
+
discord?: {
|
|
812
|
+
clientId: string;
|
|
813
|
+
redirectUri: string;
|
|
814
|
+
scope?: string;
|
|
815
|
+
};
|
|
816
|
+
github?: {
|
|
817
|
+
clientId: string;
|
|
818
|
+
redirectUri: string;
|
|
819
|
+
scope?: string;
|
|
820
|
+
};
|
|
821
|
+
}
|
|
822
|
+
interface AuthModalOptions {
|
|
823
|
+
client: SeaVerseBackendAPIClient;
|
|
824
|
+
onLoginSuccess?: (token: string, user: any) => void;
|
|
825
|
+
onSignupSuccess?: (token: string, user: any) => void;
|
|
826
|
+
onError?: (error: Error) => void;
|
|
827
|
+
theme?: 'dark' | 'light';
|
|
828
|
+
oauthConfig?: OAuthConfig;
|
|
829
|
+
}
|
|
830
|
+
interface AuthModalResult {
|
|
831
|
+
success: boolean;
|
|
832
|
+
token?: string;
|
|
833
|
+
user?: any;
|
|
834
|
+
error?: Error;
|
|
835
|
+
}
|
|
836
|
+
declare class AuthModal {
|
|
837
|
+
private client;
|
|
838
|
+
private options;
|
|
839
|
+
private modal;
|
|
840
|
+
private currentView;
|
|
841
|
+
constructor(options: AuthModalOptions);
|
|
842
|
+
/**
|
|
843
|
+
* Show the authentication modal
|
|
844
|
+
*/
|
|
845
|
+
show(initialView?: 'login' | 'signup'): void;
|
|
846
|
+
/**
|
|
847
|
+
* Hide the authentication modal
|
|
848
|
+
*/
|
|
849
|
+
hide(): void;
|
|
850
|
+
/**
|
|
851
|
+
* Destroy the modal and remove from DOM
|
|
852
|
+
*/
|
|
853
|
+
destroy(): void;
|
|
854
|
+
private createModal;
|
|
855
|
+
private createLeftPanel;
|
|
856
|
+
private createRightPanel;
|
|
857
|
+
private createLoginForm;
|
|
858
|
+
private createSignupForm;
|
|
859
|
+
private createForgotPasswordForm;
|
|
860
|
+
private createSuccessMessage;
|
|
861
|
+
private createFormGroup;
|
|
862
|
+
private createPasswordInput;
|
|
863
|
+
private createSocialButton;
|
|
864
|
+
private bindEventListeners;
|
|
865
|
+
/**
|
|
866
|
+
* Bind click events to social login buttons
|
|
867
|
+
*/
|
|
868
|
+
private bindSocialLoginButtons;
|
|
869
|
+
private switchView;
|
|
870
|
+
private handleLogin;
|
|
871
|
+
private handleSignup;
|
|
872
|
+
private handleForgotPassword;
|
|
873
|
+
private showMessage;
|
|
874
|
+
private showError;
|
|
875
|
+
/**
|
|
876
|
+
* Start OAuth flow for a given provider
|
|
877
|
+
*/
|
|
878
|
+
private startOAuthFlow;
|
|
879
|
+
/**
|
|
880
|
+
* Generate random state for CSRF protection
|
|
881
|
+
*/
|
|
882
|
+
private generateRandomState;
|
|
883
|
+
/**
|
|
884
|
+
* Build authorization URL for each provider
|
|
885
|
+
*/
|
|
886
|
+
private buildAuthUrl;
|
|
887
|
+
/**
|
|
888
|
+
* Handle OAuth callback
|
|
889
|
+
* Call this method from your redirect page with the code and state from URL
|
|
890
|
+
*/
|
|
891
|
+
handleOAuthCallback(code: string, state: string): Promise<AuthModalResult>;
|
|
892
|
+
/**
|
|
893
|
+
* Check if current page is an OAuth callback and handle it automatically
|
|
894
|
+
*/
|
|
895
|
+
static handleOAuthCallbackFromUrl(client: SeaVerseBackendAPIClient, options?: Omit<AuthModalOptions, 'client'>): Promise<AuthModalResult | null>;
|
|
896
|
+
}
|
|
897
|
+
/**
|
|
898
|
+
* Create and show auth modal
|
|
899
|
+
*/
|
|
900
|
+
declare function createAuthModal(options: AuthModalOptions): AuthModal;
|
|
901
|
+
|
|
902
|
+
export { AuthFactory, AuthModal, AuthProvider, BuiltInHooks, SeaVerseBackendAPIClient, createAuthModal, models };
|
|
903
|
+
export type { ApiError, ApiServiceTokenResponse, AuthModalOptions, AuthModalResult, CodeToTokenRequest, CodeToTokenResponse, Container, ContainerDetailResponse, ContainerListResponse, ContainerStatsResponse, ConversationStatus, CreateMarketplaceSkillRequest, CreateVideoShareRequest, CreateVideoShareResponse, ForgotPasswordRequest, ForkProjectRequest, ForkProjectResponse, HealthResponse, HubProject, HubProjectsListResponse, InviteApplication, InviteApplicationListResponse, InviteCodeBindRequest, InviteCodeGenerateResponse, InviteCodeVerifyResponse, LoginRequest, LoginResponse, MarketplaceSkill, MarketplaceSkillsListResponse, OAuthConfig, PublishProjectRequest, PublishSkillRequest, RegisterContainerRequest, RegisterContainerResponse, RegisterRequest, RegisterResponse, ResetPasswordRequest, SeaVerseBackendAPIClientOptions, SocialMediaLink, SocialMediaLinksResponse, SpeechTokenResponse, SubmitInviteApplicationRequest, SuccessResponse, TrackAppTypeRequest, User, UserInstalledSkill, UserInstalledSkillsListResponse, VideoDetails };
|