@veroai/sdk 0.1.2 → 0.1.3

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/dist/index.cjs CHANGED
@@ -1259,287 +1259,8 @@ var VoiceResource = class {
1259
1259
  }
1260
1260
  };
1261
1261
 
1262
- // src/resources/chat.ts
1263
- function transformUser(data) {
1264
- return {
1265
- id: data.id,
1266
- email: data.email,
1267
- firstName: data.first_name,
1268
- lastName: data.last_name,
1269
- isVirtual: data.is_virtual,
1270
- agentConfigId: data.agent_config_id
1271
- };
1272
- }
1273
- function transformUserWithPresence(data) {
1274
- return {
1275
- ...transformUser(data),
1276
- status: data.status,
1277
- statusMessage: data.status_message,
1278
- lastSeen: data.last_seen,
1279
- createdAt: data.created_at
1280
- };
1281
- }
1282
- function transformParticipant(data) {
1283
- return {
1284
- userId: data.user_id,
1285
- role: data.role,
1286
- isActive: data.is_active,
1287
- joinedAt: data.joined_at,
1288
- lastSeen: data.last_seen,
1289
- user: data.user ? transformUser(data.user) : void 0
1290
- };
1291
- }
1292
- function transformMessage(data) {
1293
- return {
1294
- id: data.id,
1295
- conversationId: data.conversation_id,
1296
- content: data.content,
1297
- messageType: data.message_type,
1298
- senderId: data.sender_id,
1299
- sender: data.sender ? transformUser(data.sender) : void 0,
1300
- readBy: data.read_by?.map((r) => ({
1301
- userId: r.user_id,
1302
- readAt: r.read_at
1303
- })),
1304
- metadata: data.metadata,
1305
- createdAt: data.created_at,
1306
- editedAt: data.edited_at
1307
- };
1308
- }
1309
- function transformConversation(data) {
1310
- return {
1311
- id: data.id,
1312
- name: data.name,
1313
- type: data.type,
1314
- isActive: data.is_active,
1315
- lastMessageAt: data.last_message_at,
1316
- agentEnabled: data.agent_enabled,
1317
- agentConfigId: data.agent_config_id,
1318
- participants: data.participants?.map(transformParticipant),
1319
- unreadCount: data.unread_count,
1320
- metadata: data.metadata,
1321
- createdAt: data.created_at,
1322
- updatedAt: data.updated_at
1323
- };
1324
- }
1325
- function transformPresence(data) {
1326
- return {
1327
- userId: data.user_id,
1328
- status: data.status,
1329
- statusMessage: data.status_message,
1330
- lastSeen: data.last_seen,
1331
- metadata: data.metadata
1332
- };
1333
- }
1334
- function transformAgent(data) {
1335
- return {
1336
- configId: data.config_id,
1337
- name: data.name,
1338
- userId: data.user_id,
1339
- enabled: data.enabled
1340
- };
1341
- }
1342
- var ConversationsResource = class {
1343
- constructor(http) {
1344
- this.http = http;
1345
- }
1346
- /**
1347
- * List all conversations for the current user
1348
- */
1349
- async list() {
1350
- const response = await this.http.get("/v1/chat/conversations");
1351
- return {
1352
- data: response.conversations.map(transformConversation),
1353
- total: response.total,
1354
- hasMore: false
1355
- };
1356
- }
1357
- /**
1358
- * Get a conversation by ID
1359
- */
1360
- async get(conversationId) {
1361
- const response = await this.http.get(
1362
- `/v1/chat/conversations/${conversationId}`
1363
- );
1364
- return transformConversation(response.conversation);
1365
- }
1366
- /**
1367
- * Create a new conversation
1368
- */
1369
- async create(params) {
1370
- const response = await this.http.post(
1371
- "/v1/chat/conversations",
1372
- {
1373
- type: params.type || "direct",
1374
- name: params.name,
1375
- participant_ids: params.participantIds,
1376
- agent_config_id: params.agentConfigId,
1377
- metadata: params.metadata
1378
- }
1379
- );
1380
- return transformConversation(response.conversation);
1381
- }
1382
- /**
1383
- * Get messages for a conversation
1384
- */
1385
- async getMessages(conversationId, params) {
1386
- const query = {};
1387
- if (params?.limit) query.limit = params.limit;
1388
- if (params?.offset) query.offset = params.offset;
1389
- if (params?.before) {
1390
- query.before = params.before instanceof Date ? params.before.toISOString() : params.before;
1391
- }
1392
- const response = await this.http.get(`/v1/chat/conversations/${conversationId}/messages`, query);
1393
- return {
1394
- messages: response.messages.map(transformMessage),
1395
- total: response.total,
1396
- hasMore: response.has_more
1397
- };
1398
- }
1399
- /**
1400
- * Send a message to a conversation
1401
- */
1402
- async sendMessage(conversationId, params) {
1403
- const response = await this.http.post(
1404
- `/v1/chat/conversations/${conversationId}/messages`,
1405
- {
1406
- content: params.content,
1407
- message_type: params.messageType || "text",
1408
- metadata: params.metadata
1409
- }
1410
- );
1411
- return transformMessage(response.message);
1412
- }
1413
- /**
1414
- * Mark conversation as read
1415
- */
1416
- async markRead(conversationId) {
1417
- await this.http.post(`/v1/chat/conversations/${conversationId}/read`);
1418
- }
1419
- /**
1420
- * Add participants to a conversation
1421
- */
1422
- async addParticipants(conversationId, userIds) {
1423
- const response = await this.http.post(`/v1/chat/conversations/${conversationId}/participants`, {
1424
- user_ids: userIds
1425
- });
1426
- return response.participants.map(transformParticipant);
1427
- }
1428
- /**
1429
- * Leave a conversation
1430
- */
1431
- async leave(conversationId) {
1432
- await this.http.delete(
1433
- `/v1/chat/conversations/${conversationId}/participants/me`
1434
- );
1435
- }
1436
- /**
1437
- * Add an agent to a conversation
1438
- */
1439
- async addAgent(conversationId, params) {
1440
- const response = await this.http.post(
1441
- `/v1/chat/conversations/${conversationId}/agent`,
1442
- {
1443
- agent_config_id: params.agentConfigId,
1444
- add_as_participant: params.addAsParticipant ?? true
1445
- }
1446
- );
1447
- return response.agent ? transformAgent(response.agent) : null;
1448
- }
1449
- /**
1450
- * Remove agent from a conversation
1451
- */
1452
- async removeAgent(conversationId) {
1453
- await this.http.delete(`/v1/chat/conversations/${conversationId}/agent`);
1454
- }
1455
- /**
1456
- * Toggle agent enabled/disabled
1457
- */
1458
- async setAgentEnabled(conversationId, enabled) {
1459
- await this.http.patch(`/v1/chat/conversations/${conversationId}/agent`, {
1460
- enabled
1461
- });
1462
- }
1463
- };
1464
- var ChatUsersResource = class {
1465
- constructor(http) {
1466
- this.http = http;
1467
- }
1468
- /**
1469
- * List all users in the tenant
1470
- */
1471
- async list(params) {
1472
- const query = {};
1473
- if (params?.limit) query.limit = params.limit;
1474
- if (params?.offset) query.offset = params.offset;
1475
- if (params?.includeVirtual !== void 0) {
1476
- query.include_virtual = params.includeVirtual;
1477
- }
1478
- const response = await this.http.get("/v1/chat/users", query);
1479
- return {
1480
- data: response.users.map(transformUserWithPresence),
1481
- total: response.total,
1482
- hasMore: false
1483
- };
1484
- }
1485
- /**
1486
- * Get online users
1487
- */
1488
- async online() {
1489
- const response = await this.http.get("/v1/chat/users/online");
1490
- return response.users.map(transformUserWithPresence);
1491
- }
1492
- /**
1493
- * Get current user profile and presence
1494
- */
1495
- async me() {
1496
- const response = await this.http.get(
1497
- "/v1/chat/users/me"
1498
- );
1499
- return transformUserWithPresence(response.user);
1500
- }
1501
- /**
1502
- * Update current user's presence status
1503
- */
1504
- async updateStatus(params) {
1505
- await this.http.put("/v1/chat/users/me/status", {
1506
- status: params.status,
1507
- status_message: params.statusMessage,
1508
- metadata: params.metadata
1509
- });
1510
- }
1511
- /**
1512
- * Get a user by ID
1513
- */
1514
- async get(userId) {
1515
- const response = await this.http.get(
1516
- `/v1/chat/users/${userId}`
1517
- );
1518
- return transformUserWithPresence(response.user);
1519
- }
1520
- /**
1521
- * Get presence for a specific user
1522
- */
1523
- async getPresence(userId) {
1524
- const response = await this.http.get(
1525
- `/v1/chat/users/${userId}/presence`
1526
- );
1527
- return transformPresence(response.presence);
1528
- }
1529
- };
1530
- var ChatResource = class {
1531
- /** Conversation management */
1532
- conversations;
1533
- /** User listing and presence */
1534
- users;
1535
- constructor(http) {
1536
- this.conversations = new ConversationsResource(http);
1537
- this.users = new ChatUsersResource(http);
1538
- }
1539
- };
1540
-
1541
1262
  // src/resources/agents.ts
1542
- function transformAgent2(agent) {
1263
+ function transformAgent(agent) {
1543
1264
  return {
1544
1265
  id: agent.id,
1545
1266
  name: agent.name,
@@ -1581,7 +1302,7 @@ var AgentsResource = class {
1581
1302
  `/agents${query ? `?${query}` : ""}`
1582
1303
  );
1583
1304
  return {
1584
- data: response.agents.map(transformAgent2),
1305
+ data: response.agents.map(transformAgent),
1585
1306
  total: response.total,
1586
1307
  hasMore: response.offset + response.agents.length < response.total,
1587
1308
  nextOffset: response.offset + response.agents.length < response.total ? response.offset + response.limit : void 0
@@ -1600,7 +1321,7 @@ var AgentsResource = class {
1600
1321
  const response = await this.http.get(
1601
1322
  `/agents/${encodeURIComponent(agentId)}`
1602
1323
  );
1603
- return transformAgent2(response.agent);
1324
+ return transformAgent(response.agent);
1604
1325
  }
1605
1326
  /**
1606
1327
  * Create a new AI agent
@@ -1632,7 +1353,7 @@ var AgentsResource = class {
1632
1353
  system_prompt: params.systemPrompt,
1633
1354
  enabled: params.enabled ?? false
1634
1355
  });
1635
- return transformAgent2(response.agent);
1356
+ return transformAgent(response.agent);
1636
1357
  }
1637
1358
  /**
1638
1359
  * Update an agent
@@ -1664,7 +1385,7 @@ var AgentsResource = class {
1664
1385
  `/agents/${encodeURIComponent(agentId)}`,
1665
1386
  body
1666
1387
  );
1667
- return transformAgent2(response.agent);
1388
+ return transformAgent(response.agent);
1668
1389
  }
1669
1390
  /**
1670
1391
  * Delete an agent
@@ -2138,8 +1859,6 @@ var VeroAI = class _VeroAI {
2138
1859
  voice;
2139
1860
  /** AI agent configurations */
2140
1861
  agents;
2141
- /** Chat conversations and users */
2142
- chat;
2143
1862
  /** Real-time event subscriptions via WebSocket */
2144
1863
  realtime;
2145
1864
  /**
@@ -2176,7 +1895,6 @@ var VeroAI = class _VeroAI {
2176
1895
  this.domains = new DomainsResource(this.http);
2177
1896
  this.voice = new VoiceResource(this.http);
2178
1897
  this.agents = new AgentsResource(this.http);
2179
- this.chat = new ChatResource(this.http);
2180
1898
  const tokenFetcher = async () => {
2181
1899
  const response = await this.http.post("/v1/realtime/auth", {});
2182
1900
  return response.token;
@@ -2210,9 +1928,6 @@ var VeroAI = class _VeroAI {
2210
1928
  exports.APIError = APIError;
2211
1929
  exports.AuthenticationError = AuthenticationError;
2212
1930
  exports.AuthorizationError = AuthorizationError;
2213
- exports.ChatResource = ChatResource;
2214
- exports.ChatUsersResource = ChatUsersResource;
2215
- exports.ConversationsResource = ConversationsResource;
2216
1931
  exports.NetworkError = NetworkError;
2217
1932
  exports.NotFoundError = NotFoundError;
2218
1933
  exports.RateLimitError = RateLimitError;