@elizaos/api-client 1.0.12
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/LICENSE +21 -0
- package/README.md +102 -0
- package/dist/index.d.ts +776 -0
- package/dist/index.js +721 -0
- package/dist/index.js.map +1 -0
- package/package.json +34 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,776 @@
|
|
|
1
|
+
import { UUID, ChannelType } from '@elizaos/core';
|
|
2
|
+
|
|
3
|
+
interface ApiSuccessResponse<T> {
|
|
4
|
+
success: true;
|
|
5
|
+
data: T;
|
|
6
|
+
}
|
|
7
|
+
interface ApiErrorResponse {
|
|
8
|
+
success: false;
|
|
9
|
+
error: {
|
|
10
|
+
code: string;
|
|
11
|
+
message: string;
|
|
12
|
+
details?: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
type ApiResponse<T> = ApiSuccessResponse<T> | ApiErrorResponse;
|
|
16
|
+
interface RequestConfig {
|
|
17
|
+
headers?: Record<string, string>;
|
|
18
|
+
params?: Record<string, any>;
|
|
19
|
+
timeout?: number;
|
|
20
|
+
}
|
|
21
|
+
interface PaginationParams {
|
|
22
|
+
page?: number;
|
|
23
|
+
limit?: number;
|
|
24
|
+
offset?: number;
|
|
25
|
+
}
|
|
26
|
+
interface ApiClientConfig {
|
|
27
|
+
baseUrl: string;
|
|
28
|
+
apiKey?: string;
|
|
29
|
+
timeout?: number;
|
|
30
|
+
headers?: Record<string, string>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
declare class ApiError extends Error {
|
|
34
|
+
code: string;
|
|
35
|
+
details?: string;
|
|
36
|
+
status?: number;
|
|
37
|
+
constructor(code: string, message: string, details?: string, status?: number);
|
|
38
|
+
}
|
|
39
|
+
declare abstract class BaseApiClient {
|
|
40
|
+
protected baseUrl: string;
|
|
41
|
+
protected apiKey?: string;
|
|
42
|
+
protected timeout: number;
|
|
43
|
+
protected defaultHeaders: Record<string, string>;
|
|
44
|
+
constructor(config: ApiClientConfig);
|
|
45
|
+
protected request<T>(method: string, path: string, options?: {
|
|
46
|
+
body?: any;
|
|
47
|
+
params?: Record<string, any>;
|
|
48
|
+
headers?: Record<string, string>;
|
|
49
|
+
config?: RequestConfig;
|
|
50
|
+
}): Promise<T>;
|
|
51
|
+
protected get<T>(path: string, options?: Omit<Parameters<typeof this.request>[2], 'body'>): Promise<T>;
|
|
52
|
+
protected post<T>(path: string, body?: any, options?: Parameters<typeof this.request>[2]): Promise<T>;
|
|
53
|
+
protected put<T>(path: string, body?: any, options?: Parameters<typeof this.request>[2]): Promise<T>;
|
|
54
|
+
protected patch<T>(path: string, body?: any, options?: Parameters<typeof this.request>[2]): Promise<T>;
|
|
55
|
+
protected delete<T>(path: string, options?: Omit<Parameters<typeof this.request>[2], 'body'>): Promise<T>;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
interface Agent {
|
|
59
|
+
id: UUID;
|
|
60
|
+
name: string;
|
|
61
|
+
description?: string;
|
|
62
|
+
status: 'active' | 'inactive' | 'stopped';
|
|
63
|
+
createdAt: Date;
|
|
64
|
+
updatedAt: Date;
|
|
65
|
+
metadata?: Record<string, any>;
|
|
66
|
+
}
|
|
67
|
+
interface AgentCreateParams {
|
|
68
|
+
name: string;
|
|
69
|
+
description?: string;
|
|
70
|
+
metadata?: Record<string, any>;
|
|
71
|
+
}
|
|
72
|
+
interface AgentUpdateParams {
|
|
73
|
+
name?: string;
|
|
74
|
+
description?: string;
|
|
75
|
+
metadata?: Record<string, any>;
|
|
76
|
+
}
|
|
77
|
+
interface AgentWorld {
|
|
78
|
+
id: UUID;
|
|
79
|
+
name: string;
|
|
80
|
+
description?: string;
|
|
81
|
+
agents?: Agent[];
|
|
82
|
+
}
|
|
83
|
+
interface AgentWorldSettings {
|
|
84
|
+
worldId: UUID;
|
|
85
|
+
settings: Record<string, any>;
|
|
86
|
+
}
|
|
87
|
+
interface AgentPanel {
|
|
88
|
+
id: string;
|
|
89
|
+
name: string;
|
|
90
|
+
url: string;
|
|
91
|
+
type: string;
|
|
92
|
+
metadata?: Record<string, any>;
|
|
93
|
+
}
|
|
94
|
+
interface AgentLog {
|
|
95
|
+
id: UUID;
|
|
96
|
+
agentId: UUID;
|
|
97
|
+
level: 'debug' | 'info' | 'warn' | 'error';
|
|
98
|
+
message: string;
|
|
99
|
+
timestamp: Date;
|
|
100
|
+
metadata?: Record<string, any>;
|
|
101
|
+
}
|
|
102
|
+
interface AgentLogsParams extends PaginationParams {
|
|
103
|
+
level?: 'debug' | 'info' | 'warn' | 'error';
|
|
104
|
+
from?: Date | string;
|
|
105
|
+
to?: Date | string;
|
|
106
|
+
search?: string;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
declare class AgentsService extends BaseApiClient {
|
|
110
|
+
/**
|
|
111
|
+
* List all agents with minimal details
|
|
112
|
+
*/
|
|
113
|
+
listAgents(): Promise<{
|
|
114
|
+
agents: Agent[];
|
|
115
|
+
}>;
|
|
116
|
+
/**
|
|
117
|
+
* Get specific agent details
|
|
118
|
+
*/
|
|
119
|
+
getAgent(agentId: UUID): Promise<Agent>;
|
|
120
|
+
/**
|
|
121
|
+
* Create a new agent
|
|
122
|
+
*/
|
|
123
|
+
createAgent(params: AgentCreateParams): Promise<Agent>;
|
|
124
|
+
/**
|
|
125
|
+
* Update an existing agent
|
|
126
|
+
*/
|
|
127
|
+
updateAgent(agentId: UUID, params: AgentUpdateParams): Promise<Agent>;
|
|
128
|
+
/**
|
|
129
|
+
* Delete an agent
|
|
130
|
+
*/
|
|
131
|
+
deleteAgent(agentId: UUID): Promise<{
|
|
132
|
+
success: boolean;
|
|
133
|
+
}>;
|
|
134
|
+
/**
|
|
135
|
+
* Start an existing agent
|
|
136
|
+
*/
|
|
137
|
+
startAgent(agentId: UUID): Promise<{
|
|
138
|
+
status: string;
|
|
139
|
+
}>;
|
|
140
|
+
/**
|
|
141
|
+
* Stop a running agent
|
|
142
|
+
*/
|
|
143
|
+
stopAgent(agentId: UUID): Promise<{
|
|
144
|
+
status: string;
|
|
145
|
+
}>;
|
|
146
|
+
/**
|
|
147
|
+
* Get all available worlds
|
|
148
|
+
*/
|
|
149
|
+
getWorlds(): Promise<{
|
|
150
|
+
worlds: AgentWorld[];
|
|
151
|
+
}>;
|
|
152
|
+
/**
|
|
153
|
+
* Add agent to a world
|
|
154
|
+
*/
|
|
155
|
+
addAgentToWorld(agentId: UUID, worldId: UUID): Promise<{
|
|
156
|
+
success: boolean;
|
|
157
|
+
}>;
|
|
158
|
+
/**
|
|
159
|
+
* Update agent's world settings
|
|
160
|
+
*/
|
|
161
|
+
updateAgentWorldSettings(agentId: UUID, worldId: UUID, settings: Record<string, any>): Promise<AgentWorldSettings>;
|
|
162
|
+
/**
|
|
163
|
+
* Get agent's plugin panels
|
|
164
|
+
*/
|
|
165
|
+
getAgentPanels(agentId: UUID): Promise<{
|
|
166
|
+
panels: AgentPanel[];
|
|
167
|
+
}>;
|
|
168
|
+
/**
|
|
169
|
+
* Get agent logs
|
|
170
|
+
*/
|
|
171
|
+
getAgentLogs(agentId: UUID, params?: AgentLogsParams): Promise<{
|
|
172
|
+
logs: AgentLog[];
|
|
173
|
+
}>;
|
|
174
|
+
/**
|
|
175
|
+
* Delete a specific log entry
|
|
176
|
+
*/
|
|
177
|
+
deleteAgentLog(agentId: UUID, logId: UUID): Promise<{
|
|
178
|
+
success: boolean;
|
|
179
|
+
}>;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
interface MessageServer {
|
|
183
|
+
id: UUID;
|
|
184
|
+
name: string;
|
|
185
|
+
sourceType: string;
|
|
186
|
+
sourceId?: string;
|
|
187
|
+
metadata?: Record<string, any>;
|
|
188
|
+
createdAt: Date;
|
|
189
|
+
updatedAt: Date;
|
|
190
|
+
}
|
|
191
|
+
interface MessageChannel {
|
|
192
|
+
id: UUID;
|
|
193
|
+
messageServerId: UUID;
|
|
194
|
+
name: string;
|
|
195
|
+
type: ChannelType;
|
|
196
|
+
sourceType?: string;
|
|
197
|
+
sourceId?: string;
|
|
198
|
+
topic?: string;
|
|
199
|
+
metadata?: Record<string, any>;
|
|
200
|
+
createdAt: Date;
|
|
201
|
+
updatedAt: Date;
|
|
202
|
+
}
|
|
203
|
+
interface Message {
|
|
204
|
+
id: UUID;
|
|
205
|
+
channelId: UUID;
|
|
206
|
+
authorId: UUID;
|
|
207
|
+
content: string;
|
|
208
|
+
rawMessage?: any;
|
|
209
|
+
inReplyToRootMessageId?: UUID;
|
|
210
|
+
sourceType?: string;
|
|
211
|
+
sourceId?: string;
|
|
212
|
+
createdAt: Date;
|
|
213
|
+
updatedAt: Date;
|
|
214
|
+
metadata?: Record<string, any>;
|
|
215
|
+
}
|
|
216
|
+
interface MessageSubmitParams {
|
|
217
|
+
agentId: UUID;
|
|
218
|
+
channelId: UUID;
|
|
219
|
+
content: string;
|
|
220
|
+
inReplyToMessageId?: UUID;
|
|
221
|
+
metadata?: Record<string, any>;
|
|
222
|
+
}
|
|
223
|
+
interface MessageCompleteParams {
|
|
224
|
+
messageId: UUID;
|
|
225
|
+
status: 'completed' | 'failed';
|
|
226
|
+
error?: string;
|
|
227
|
+
}
|
|
228
|
+
interface ExternalMessageParams {
|
|
229
|
+
platform: string;
|
|
230
|
+
channelId: string;
|
|
231
|
+
messages: Array<{
|
|
232
|
+
id: string;
|
|
233
|
+
authorId: string;
|
|
234
|
+
content: string;
|
|
235
|
+
timestamp: number;
|
|
236
|
+
metadata?: Record<string, any>;
|
|
237
|
+
}>;
|
|
238
|
+
}
|
|
239
|
+
interface ChannelCreateParams {
|
|
240
|
+
name: string;
|
|
241
|
+
type: ChannelType;
|
|
242
|
+
serverId?: UUID;
|
|
243
|
+
metadata?: Record<string, any>;
|
|
244
|
+
}
|
|
245
|
+
interface GroupChannelCreateParams {
|
|
246
|
+
name: string;
|
|
247
|
+
participantIds: UUID[];
|
|
248
|
+
metadata?: Record<string, any>;
|
|
249
|
+
}
|
|
250
|
+
interface DmChannelParams {
|
|
251
|
+
participantIds: [UUID, UUID];
|
|
252
|
+
}
|
|
253
|
+
interface ChannelParticipant {
|
|
254
|
+
id: UUID;
|
|
255
|
+
channelId: UUID;
|
|
256
|
+
userId: UUID;
|
|
257
|
+
role?: string;
|
|
258
|
+
joinedAt: Date;
|
|
259
|
+
}
|
|
260
|
+
interface MessageSearchParams extends PaginationParams {
|
|
261
|
+
query?: string;
|
|
262
|
+
channelId?: UUID;
|
|
263
|
+
authorId?: UUID;
|
|
264
|
+
from?: Date | string;
|
|
265
|
+
to?: Date | string;
|
|
266
|
+
}
|
|
267
|
+
interface ServerCreateParams {
|
|
268
|
+
name: string;
|
|
269
|
+
sourceType: string;
|
|
270
|
+
sourceId?: string;
|
|
271
|
+
metadata?: Record<string, any>;
|
|
272
|
+
}
|
|
273
|
+
interface ServerSyncParams {
|
|
274
|
+
channels: Array<{
|
|
275
|
+
name: string;
|
|
276
|
+
type: ChannelType;
|
|
277
|
+
sourceId: string;
|
|
278
|
+
}>;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
declare class MessagingService extends BaseApiClient {
|
|
282
|
+
/**
|
|
283
|
+
* Submit agent replies or system messages
|
|
284
|
+
*/
|
|
285
|
+
submitMessage(params: MessageSubmitParams): Promise<Message>;
|
|
286
|
+
/**
|
|
287
|
+
* Notify message completion
|
|
288
|
+
*/
|
|
289
|
+
completeMessage(params: MessageCompleteParams): Promise<{
|
|
290
|
+
success: boolean;
|
|
291
|
+
}>;
|
|
292
|
+
/**
|
|
293
|
+
* Ingest messages from external platforms
|
|
294
|
+
*/
|
|
295
|
+
ingestExternalMessages(params: ExternalMessageParams): Promise<{
|
|
296
|
+
processed: number;
|
|
297
|
+
}>;
|
|
298
|
+
/**
|
|
299
|
+
* Create a new channel
|
|
300
|
+
*/
|
|
301
|
+
createChannel(params: ChannelCreateParams): Promise<MessageChannel>;
|
|
302
|
+
/**
|
|
303
|
+
* Create a group channel
|
|
304
|
+
*/
|
|
305
|
+
createGroupChannel(params: GroupChannelCreateParams): Promise<MessageChannel>;
|
|
306
|
+
/**
|
|
307
|
+
* Find or create a DM channel
|
|
308
|
+
*/
|
|
309
|
+
getOrCreateDmChannel(params: DmChannelParams): Promise<MessageChannel>;
|
|
310
|
+
/**
|
|
311
|
+
* Get channel details
|
|
312
|
+
*/
|
|
313
|
+
getChannelDetails(channelId: UUID): Promise<MessageChannel>;
|
|
314
|
+
/**
|
|
315
|
+
* Get channel participants
|
|
316
|
+
*/
|
|
317
|
+
getChannelParticipants(channelId: UUID): Promise<{
|
|
318
|
+
participants: ChannelParticipant[];
|
|
319
|
+
}>;
|
|
320
|
+
/**
|
|
321
|
+
* Add agent to channel
|
|
322
|
+
*/
|
|
323
|
+
addAgentToChannel(channelId: UUID, agentId: UUID): Promise<{
|
|
324
|
+
success: boolean;
|
|
325
|
+
}>;
|
|
326
|
+
/**
|
|
327
|
+
* Remove agent from channel
|
|
328
|
+
*/
|
|
329
|
+
removeAgentFromChannel(channelId: UUID, agentId: UUID): Promise<{
|
|
330
|
+
success: boolean;
|
|
331
|
+
}>;
|
|
332
|
+
/**
|
|
333
|
+
* Delete a channel
|
|
334
|
+
*/
|
|
335
|
+
deleteChannel(channelId: UUID): Promise<{
|
|
336
|
+
success: boolean;
|
|
337
|
+
}>;
|
|
338
|
+
/**
|
|
339
|
+
* Clear channel history
|
|
340
|
+
*/
|
|
341
|
+
clearChannelHistory(channelId: UUID): Promise<{
|
|
342
|
+
deleted: number;
|
|
343
|
+
}>;
|
|
344
|
+
/**
|
|
345
|
+
* Post a new message to a channel
|
|
346
|
+
*/
|
|
347
|
+
postMessage(channelId: UUID, content: string, metadata?: Record<string, any>): Promise<Message>;
|
|
348
|
+
/**
|
|
349
|
+
* Get channel messages
|
|
350
|
+
*/
|
|
351
|
+
getChannelMessages(channelId: UUID, params?: PaginationParams & {
|
|
352
|
+
before?: Date | string;
|
|
353
|
+
after?: Date | string;
|
|
354
|
+
}): Promise<{
|
|
355
|
+
messages: Message[];
|
|
356
|
+
}>;
|
|
357
|
+
/**
|
|
358
|
+
* Get a specific message
|
|
359
|
+
*/
|
|
360
|
+
getMessage(messageId: UUID): Promise<Message>;
|
|
361
|
+
/**
|
|
362
|
+
* Delete a message
|
|
363
|
+
*/
|
|
364
|
+
deleteMessage(messageId: UUID): Promise<{
|
|
365
|
+
success: boolean;
|
|
366
|
+
}>;
|
|
367
|
+
/**
|
|
368
|
+
* Update a message
|
|
369
|
+
*/
|
|
370
|
+
updateMessage(messageId: UUID, content: string): Promise<Message>;
|
|
371
|
+
/**
|
|
372
|
+
* Search messages
|
|
373
|
+
*/
|
|
374
|
+
searchMessages(params: MessageSearchParams): Promise<{
|
|
375
|
+
messages: Message[];
|
|
376
|
+
}>;
|
|
377
|
+
/**
|
|
378
|
+
* List all message servers
|
|
379
|
+
*/
|
|
380
|
+
listServers(): Promise<{
|
|
381
|
+
servers: MessageServer[];
|
|
382
|
+
}>;
|
|
383
|
+
/**
|
|
384
|
+
* Get server channels
|
|
385
|
+
*/
|
|
386
|
+
getServerChannels(serverId: UUID): Promise<{
|
|
387
|
+
channels: MessageChannel[];
|
|
388
|
+
}>;
|
|
389
|
+
/**
|
|
390
|
+
* Create a new server
|
|
391
|
+
*/
|
|
392
|
+
createServer(params: ServerCreateParams): Promise<MessageServer>;
|
|
393
|
+
/**
|
|
394
|
+
* Sync server channels
|
|
395
|
+
*/
|
|
396
|
+
syncServerChannels(serverId: UUID, params: ServerSyncParams): Promise<{
|
|
397
|
+
synced: number;
|
|
398
|
+
}>;
|
|
399
|
+
/**
|
|
400
|
+
* Delete a server
|
|
401
|
+
*/
|
|
402
|
+
deleteServer(serverId: UUID): Promise<{
|
|
403
|
+
success: boolean;
|
|
404
|
+
}>;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
interface Memory {
|
|
408
|
+
id: UUID;
|
|
409
|
+
agentId: UUID;
|
|
410
|
+
roomId?: UUID;
|
|
411
|
+
type: string;
|
|
412
|
+
content: any;
|
|
413
|
+
embedding?: number[];
|
|
414
|
+
createdAt: Date;
|
|
415
|
+
updatedAt: Date;
|
|
416
|
+
metadata?: Record<string, any>;
|
|
417
|
+
}
|
|
418
|
+
interface Room {
|
|
419
|
+
id: UUID;
|
|
420
|
+
agentId: UUID;
|
|
421
|
+
name: string;
|
|
422
|
+
type?: string;
|
|
423
|
+
createdAt: Date;
|
|
424
|
+
updatedAt: Date;
|
|
425
|
+
metadata?: Record<string, any>;
|
|
426
|
+
}
|
|
427
|
+
interface MemoryParams extends PaginationParams {
|
|
428
|
+
type?: string;
|
|
429
|
+
search?: string;
|
|
430
|
+
from?: Date | string;
|
|
431
|
+
to?: Date | string;
|
|
432
|
+
}
|
|
433
|
+
interface MemoryUpdateParams {
|
|
434
|
+
content?: any;
|
|
435
|
+
metadata?: Record<string, any>;
|
|
436
|
+
}
|
|
437
|
+
interface RoomCreateParams {
|
|
438
|
+
name: string;
|
|
439
|
+
type?: string;
|
|
440
|
+
metadata?: Record<string, any>;
|
|
441
|
+
}
|
|
442
|
+
interface WorldCreateParams {
|
|
443
|
+
serverId: UUID;
|
|
444
|
+
name: string;
|
|
445
|
+
description?: string;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
declare class MemoryService extends BaseApiClient {
|
|
449
|
+
/**
|
|
450
|
+
* Get agent memories
|
|
451
|
+
*/
|
|
452
|
+
getAgentMemories(agentId: UUID, params?: MemoryParams): Promise<{
|
|
453
|
+
memories: Memory[];
|
|
454
|
+
}>;
|
|
455
|
+
/**
|
|
456
|
+
* Get room-specific memories
|
|
457
|
+
*/
|
|
458
|
+
getRoomMemories(agentId: UUID, roomId: UUID, params?: MemoryParams): Promise<{
|
|
459
|
+
memories: Memory[];
|
|
460
|
+
}>;
|
|
461
|
+
/**
|
|
462
|
+
* Update a memory
|
|
463
|
+
*/
|
|
464
|
+
updateMemory(agentId: UUID, memoryId: UUID, params: MemoryUpdateParams): Promise<Memory>;
|
|
465
|
+
/**
|
|
466
|
+
* Clear all agent memories
|
|
467
|
+
*/
|
|
468
|
+
clearAgentMemories(agentId: UUID): Promise<{
|
|
469
|
+
deleted: number;
|
|
470
|
+
}>;
|
|
471
|
+
/**
|
|
472
|
+
* Clear room memories
|
|
473
|
+
*/
|
|
474
|
+
clearRoomMemories(agentId: UUID, roomId: UUID): Promise<{
|
|
475
|
+
deleted: number;
|
|
476
|
+
}>;
|
|
477
|
+
/**
|
|
478
|
+
* List agent's rooms
|
|
479
|
+
*/
|
|
480
|
+
listAgentRooms(agentId: UUID): Promise<{
|
|
481
|
+
rooms: Room[];
|
|
482
|
+
}>;
|
|
483
|
+
/**
|
|
484
|
+
* Get room details
|
|
485
|
+
*/
|
|
486
|
+
getRoom(agentId: UUID, roomId: UUID): Promise<Room>;
|
|
487
|
+
/**
|
|
488
|
+
* Create a room
|
|
489
|
+
*/
|
|
490
|
+
createRoom(agentId: UUID, params: RoomCreateParams): Promise<Room>;
|
|
491
|
+
/**
|
|
492
|
+
* Create world from server
|
|
493
|
+
*/
|
|
494
|
+
createWorldFromServer(serverId: UUID, params: WorldCreateParams): Promise<{
|
|
495
|
+
worldId: UUID;
|
|
496
|
+
}>;
|
|
497
|
+
/**
|
|
498
|
+
* Delete a world
|
|
499
|
+
*/
|
|
500
|
+
deleteWorld(serverId: UUID): Promise<{
|
|
501
|
+
success: boolean;
|
|
502
|
+
}>;
|
|
503
|
+
/**
|
|
504
|
+
* Clear world memories
|
|
505
|
+
*/
|
|
506
|
+
clearWorldMemories(serverId: UUID): Promise<{
|
|
507
|
+
deleted: number;
|
|
508
|
+
}>;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
interface SpeechConversationParams {
|
|
512
|
+
audio: Blob | Buffer | string;
|
|
513
|
+
format?: 'mp3' | 'wav' | 'ogg' | 'webm';
|
|
514
|
+
language?: string;
|
|
515
|
+
metadata?: Record<string, any>;
|
|
516
|
+
}
|
|
517
|
+
interface SpeechGenerateParams {
|
|
518
|
+
text: string;
|
|
519
|
+
voice?: string;
|
|
520
|
+
language?: string;
|
|
521
|
+
speed?: number;
|
|
522
|
+
pitch?: number;
|
|
523
|
+
}
|
|
524
|
+
interface AudioSynthesizeParams {
|
|
525
|
+
messageId: UUID;
|
|
526
|
+
voice?: string;
|
|
527
|
+
format?: 'mp3' | 'wav' | 'ogg';
|
|
528
|
+
}
|
|
529
|
+
interface TranscribeParams {
|
|
530
|
+
audio: Blob | Buffer | string;
|
|
531
|
+
format?: 'mp3' | 'wav' | 'ogg' | 'webm';
|
|
532
|
+
language?: string;
|
|
533
|
+
}
|
|
534
|
+
interface SpeechResponse {
|
|
535
|
+
text?: string;
|
|
536
|
+
audio?: string;
|
|
537
|
+
duration?: number;
|
|
538
|
+
metadata?: Record<string, any>;
|
|
539
|
+
}
|
|
540
|
+
interface TranscriptionResponse {
|
|
541
|
+
text: string;
|
|
542
|
+
language?: string;
|
|
543
|
+
confidence?: number;
|
|
544
|
+
words?: Array<{
|
|
545
|
+
word: string;
|
|
546
|
+
start: number;
|
|
547
|
+
end: number;
|
|
548
|
+
confidence?: number;
|
|
549
|
+
}>;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
declare class AudioService extends BaseApiClient {
|
|
553
|
+
/**
|
|
554
|
+
* Convert audio input to appropriate FormData value
|
|
555
|
+
*/
|
|
556
|
+
private processAudioInput;
|
|
557
|
+
/**
|
|
558
|
+
* Check if a string appears to be base64 encoded
|
|
559
|
+
*/
|
|
560
|
+
private isBase64String;
|
|
561
|
+
/**
|
|
562
|
+
* Safe check for Buffer type (works in both Node.js and browser environments)
|
|
563
|
+
*/
|
|
564
|
+
private isBuffer;
|
|
565
|
+
/**
|
|
566
|
+
* Handle speech conversation
|
|
567
|
+
*/
|
|
568
|
+
speechConversation(agentId: UUID, params: SpeechConversationParams): Promise<SpeechResponse>;
|
|
569
|
+
/**
|
|
570
|
+
* Generate speech from text
|
|
571
|
+
*/
|
|
572
|
+
generateSpeech(agentId: UUID, params: SpeechGenerateParams): Promise<{
|
|
573
|
+
audio: string;
|
|
574
|
+
format: string;
|
|
575
|
+
}>;
|
|
576
|
+
/**
|
|
577
|
+
* Synthesize audio message
|
|
578
|
+
*/
|
|
579
|
+
synthesizeAudioMessage(agentId: UUID, params: AudioSynthesizeParams): Promise<{
|
|
580
|
+
audio: string;
|
|
581
|
+
format: string;
|
|
582
|
+
}>;
|
|
583
|
+
/**
|
|
584
|
+
* Transcribe audio to text
|
|
585
|
+
*/
|
|
586
|
+
transcribe(agentId: UUID, params: TranscribeParams): Promise<TranscriptionResponse>;
|
|
587
|
+
/**
|
|
588
|
+
* Process speech input
|
|
589
|
+
*/
|
|
590
|
+
processSpeech(agentId: UUID, audio: Blob | Buffer | string, metadata?: Record<string, any>): Promise<SpeechResponse>;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
interface MediaUploadParams {
|
|
594
|
+
file: File | Blob;
|
|
595
|
+
filename?: string;
|
|
596
|
+
contentType?: string;
|
|
597
|
+
metadata?: Record<string, any>;
|
|
598
|
+
}
|
|
599
|
+
interface MediaUploadResponse {
|
|
600
|
+
id: UUID;
|
|
601
|
+
filename: string;
|
|
602
|
+
url: string;
|
|
603
|
+
size: number;
|
|
604
|
+
contentType: string;
|
|
605
|
+
uploadedAt: Date;
|
|
606
|
+
metadata?: Record<string, any>;
|
|
607
|
+
}
|
|
608
|
+
interface ChannelUploadParams {
|
|
609
|
+
files: Array<File | Blob>;
|
|
610
|
+
messageId?: UUID;
|
|
611
|
+
metadata?: Record<string, any>;
|
|
612
|
+
}
|
|
613
|
+
interface ChannelUploadResponse {
|
|
614
|
+
uploads: MediaUploadResponse[];
|
|
615
|
+
totalSize: number;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
declare class MediaService extends BaseApiClient {
|
|
619
|
+
/**
|
|
620
|
+
* Upload media for an agent
|
|
621
|
+
*/
|
|
622
|
+
uploadAgentMedia(agentId: UUID, params: MediaUploadParams): Promise<MediaUploadResponse>;
|
|
623
|
+
/**
|
|
624
|
+
* Upload files to a channel
|
|
625
|
+
*/
|
|
626
|
+
uploadChannelFiles(channelId: UUID, params: ChannelUploadParams): Promise<ChannelUploadResponse>;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
interface ServerHealth {
|
|
630
|
+
status: 'healthy' | 'degraded' | 'unhealthy';
|
|
631
|
+
uptime: number;
|
|
632
|
+
timestamp: Date;
|
|
633
|
+
version?: string;
|
|
634
|
+
checks?: Record<string, {
|
|
635
|
+
status: 'pass' | 'fail';
|
|
636
|
+
message?: string;
|
|
637
|
+
}>;
|
|
638
|
+
}
|
|
639
|
+
interface ServerStatus {
|
|
640
|
+
agents: {
|
|
641
|
+
total: number;
|
|
642
|
+
active: number;
|
|
643
|
+
inactive: number;
|
|
644
|
+
};
|
|
645
|
+
memory: {
|
|
646
|
+
used: number;
|
|
647
|
+
total: number;
|
|
648
|
+
percentage: number;
|
|
649
|
+
};
|
|
650
|
+
uptime: number;
|
|
651
|
+
version: string;
|
|
652
|
+
}
|
|
653
|
+
interface ServerDebugInfo {
|
|
654
|
+
runtime: {
|
|
655
|
+
agents: Array<{
|
|
656
|
+
id: UUID;
|
|
657
|
+
name: string;
|
|
658
|
+
status: string;
|
|
659
|
+
}>;
|
|
660
|
+
connections: number;
|
|
661
|
+
memory: any;
|
|
662
|
+
};
|
|
663
|
+
environment: Record<string, string>;
|
|
664
|
+
}
|
|
665
|
+
interface LogSubmitParams {
|
|
666
|
+
level: 'debug' | 'info' | 'warn' | 'error';
|
|
667
|
+
message: string;
|
|
668
|
+
source?: string;
|
|
669
|
+
metadata?: Record<string, any>;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
declare class ServerService extends BaseApiClient {
|
|
673
|
+
/**
|
|
674
|
+
* Health check
|
|
675
|
+
*/
|
|
676
|
+
checkHealth(): Promise<ServerHealth>;
|
|
677
|
+
/**
|
|
678
|
+
* Simple ping
|
|
679
|
+
*/
|
|
680
|
+
ping(): Promise<{
|
|
681
|
+
pong: boolean;
|
|
682
|
+
}>;
|
|
683
|
+
/**
|
|
684
|
+
* Hello endpoint
|
|
685
|
+
*/
|
|
686
|
+
hello(): Promise<{
|
|
687
|
+
message: string;
|
|
688
|
+
}>;
|
|
689
|
+
/**
|
|
690
|
+
* Get server status
|
|
691
|
+
*/
|
|
692
|
+
getStatus(): Promise<ServerStatus>;
|
|
693
|
+
/**
|
|
694
|
+
* Stop the server
|
|
695
|
+
*/
|
|
696
|
+
stopServer(): Promise<{
|
|
697
|
+
success: boolean;
|
|
698
|
+
}>;
|
|
699
|
+
/**
|
|
700
|
+
* Get runtime debug info
|
|
701
|
+
*/
|
|
702
|
+
getDebugInfo(): Promise<ServerDebugInfo>;
|
|
703
|
+
/**
|
|
704
|
+
* Submit logs
|
|
705
|
+
*/
|
|
706
|
+
submitLogs(logs: LogSubmitParams[]): Promise<{
|
|
707
|
+
received: number;
|
|
708
|
+
}>;
|
|
709
|
+
/**
|
|
710
|
+
* Clear logs
|
|
711
|
+
*/
|
|
712
|
+
clearLogs(): Promise<{
|
|
713
|
+
cleared: number;
|
|
714
|
+
}>;
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
interface SystemEnvironment {
|
|
718
|
+
nodeVersion: string;
|
|
719
|
+
platform: string;
|
|
720
|
+
environment: 'development' | 'production' | 'test';
|
|
721
|
+
features: {
|
|
722
|
+
authentication: boolean;
|
|
723
|
+
tee: boolean;
|
|
724
|
+
plugins: string[];
|
|
725
|
+
};
|
|
726
|
+
configuration: Record<string, any>;
|
|
727
|
+
}
|
|
728
|
+
interface LocalEnvironmentUpdateParams {
|
|
729
|
+
variables: Record<string, string>;
|
|
730
|
+
merge?: boolean;
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
declare class SystemService extends BaseApiClient {
|
|
734
|
+
/**
|
|
735
|
+
* Retrieve the local environment variables from the ElizaOS server.
|
|
736
|
+
*
|
|
737
|
+
* Server route (packages/server/src/api/system):
|
|
738
|
+
* GET /api/system/env/local -> { success: true, data: Record<string,string> }
|
|
739
|
+
*/
|
|
740
|
+
getEnvironment(): Promise<Record<string, string>>;
|
|
741
|
+
/**
|
|
742
|
+
* Update (overwrite or merge) the local .env file on the ElizaOS server.
|
|
743
|
+
*
|
|
744
|
+
* Server route (packages/server/src/api/system):
|
|
745
|
+
* POST /api/system/env/local -> { success: true, message: string }
|
|
746
|
+
* Body: { content: Record<string,string> }
|
|
747
|
+
*
|
|
748
|
+
* For developer-ergonomics we accept several shapes:
|
|
749
|
+
* 1. { variables: Record<string,string>; merge?: boolean }
|
|
750
|
+
* 2. { content: Record<string,string> } (server-native)
|
|
751
|
+
* 3. Record<string,string> (shorthand)
|
|
752
|
+
*/
|
|
753
|
+
updateLocalEnvironment(params: LocalEnvironmentUpdateParams | {
|
|
754
|
+
content: Record<string, string>;
|
|
755
|
+
} | Record<string, string>): Promise<{
|
|
756
|
+
success: boolean;
|
|
757
|
+
message: string;
|
|
758
|
+
}>;
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
declare class ElizaClient {
|
|
762
|
+
readonly agents: AgentsService;
|
|
763
|
+
readonly messaging: MessagingService;
|
|
764
|
+
readonly memory: MemoryService;
|
|
765
|
+
readonly audio: AudioService;
|
|
766
|
+
readonly media: MediaService;
|
|
767
|
+
readonly server: ServerService;
|
|
768
|
+
readonly system: SystemService;
|
|
769
|
+
constructor(config: ApiClientConfig);
|
|
770
|
+
/**
|
|
771
|
+
* Create a new ElizaClient instance
|
|
772
|
+
*/
|
|
773
|
+
static create(config: ApiClientConfig): ElizaClient;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
export { type Agent, type AgentCreateParams, type AgentLog, type AgentLogsParams, type AgentPanel, type AgentUpdateParams, type AgentWorld, type AgentWorldSettings, AgentsService, type ApiClientConfig, ApiError, type ApiErrorResponse, type ApiResponse, type ApiSuccessResponse, AudioService, type AudioSynthesizeParams, BaseApiClient, type ChannelCreateParams, type ChannelParticipant, type ChannelUploadParams, type ChannelUploadResponse, type DmChannelParams, ElizaClient, type ExternalMessageParams, type GroupChannelCreateParams, type LocalEnvironmentUpdateParams, type LogSubmitParams, MediaService, type MediaUploadParams, type MediaUploadResponse, type Memory, type MemoryParams, MemoryService, type MemoryUpdateParams, type Message, type MessageChannel, type MessageCompleteParams, type MessageSearchParams, type MessageServer, type MessageSubmitParams, MessagingService, type PaginationParams, type RequestConfig, type Room, type RoomCreateParams, type ServerCreateParams, type ServerDebugInfo, type ServerHealth, ServerService, type ServerStatus, type ServerSyncParams, type SpeechConversationParams, type SpeechGenerateParams, type SpeechResponse, type SystemEnvironment, SystemService, type TranscribeParams, type TranscriptionResponse, type WorldCreateParams };
|