@antipopp/agno-client 0.12.0 → 0.13.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 CHANGED
@@ -157,7 +157,7 @@ const messages = await client.loadSession('session-id');
157
157
  Fetch all sessions for current agent/team.
158
158
 
159
159
  ```typescript
160
- const sessions = await client.fetchSessions();
160
+ const { data, meta } = await client.fetchSessions();
161
161
  ```
162
162
 
163
163
  #### `initialize()`
@@ -245,7 +245,9 @@ Logger.debug('Config loaded', {
245
245
 
246
246
  ```typescript
247
247
  // Fetch all sessions
248
- const sessions = await client.fetchSessions();
248
+ const { data: sessions, meta } = await client.fetchSessions();
249
+
250
+ console.log(`Loaded ${meta.total_count} sessions across ${meta.total_pages} pages`);
249
251
 
250
252
  // Load a specific session
251
253
  const messages = await client.loadSession(sessions[0].session_id);
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { AgnoClientConfig, ChatMessage, ClientState, SendMessageOptions, SessionEntry, ToolCall, UIComponentSpec, AgentDetails, TeamDetails } from '@antipopp/agno-types';
2
- export { AgentDetails, AgnoClientConfig, AudioData, ChatMessage, ClientState, ImageData, MessageExtraData, ResponseAudioData, RunEvent, RunResponse, RunResponseContent, SessionEntry, TeamDetails, ToolCall, VideoData } from '@antipopp/agno-types';
1
+ import { AgnoClientConfig, ChatMessage, ClientState, SendMessageOptions, SessionsListResponse, ToolCall, UIComponentSpec, AgentDetails, TeamDetails } from '@antipopp/agno-types';
2
+ export { AgentDetails, AgnoClientConfig, AudioData, ChatMessage, ClientState, ImageData, MessageExtraData, PaginationInfo, ResponseAudioData, RunEvent, RunResponse, RunResponseContent, SessionEntry, SessionsListResponse, TeamDetails, ToolCall, VideoData } from '@antipopp/agno-types';
3
3
  import EventEmitter from 'eventemitter3';
4
4
 
5
5
  /**
@@ -86,7 +86,7 @@ declare class AgnoClient extends EventEmitter {
86
86
  */
87
87
  fetchSessions(options?: {
88
88
  params?: Record<string, string>;
89
- }): Promise<SessionEntry[]>;
89
+ }): Promise<SessionsListResponse>;
90
90
  /**
91
91
  * Delete a session
92
92
  */
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { AgnoClientConfig, ChatMessage, ClientState, SendMessageOptions, SessionEntry, ToolCall, UIComponentSpec, AgentDetails, TeamDetails } from '@antipopp/agno-types';
2
- export { AgentDetails, AgnoClientConfig, AudioData, ChatMessage, ClientState, ImageData, MessageExtraData, ResponseAudioData, RunEvent, RunResponse, RunResponseContent, SessionEntry, TeamDetails, ToolCall, VideoData } from '@antipopp/agno-types';
1
+ import { AgnoClientConfig, ChatMessage, ClientState, SendMessageOptions, SessionsListResponse, ToolCall, UIComponentSpec, AgentDetails, TeamDetails } from '@antipopp/agno-types';
2
+ export { AgentDetails, AgnoClientConfig, AudioData, ChatMessage, ClientState, ImageData, MessageExtraData, PaginationInfo, ResponseAudioData, RunEvent, RunResponse, RunResponseContent, SessionEntry, SessionsListResponse, TeamDetails, ToolCall, VideoData } from '@antipopp/agno-types';
3
3
  import EventEmitter from 'eventemitter3';
4
4
 
5
5
  /**
@@ -86,7 +86,7 @@ declare class AgnoClient extends EventEmitter {
86
86
  */
87
87
  fetchSessions(options?: {
88
88
  params?: Record<string, string>;
89
- }): Promise<SessionEntry[]>;
89
+ }): Promise<SessionsListResponse>;
90
90
  /**
91
91
  * Delete a session
92
92
  */
package/dist/index.js CHANGED
@@ -289,6 +289,13 @@ var ConfigManager = class {
289
289
  };
290
290
 
291
291
  // src/managers/session-manager.ts
292
+ var EMPTY_PAGINATION_INFO = {
293
+ page: 1,
294
+ limit: 0,
295
+ total_pages: 0,
296
+ total_count: 0,
297
+ search_time_ms: 0
298
+ };
292
299
  var SessionManager = class {
293
300
  /**
294
301
  * Fetch all sessions for an entity
@@ -306,12 +313,18 @@ var SessionManager = class {
306
313
  const response = await fetch(url.toString(), { headers });
307
314
  if (!response.ok) {
308
315
  if (response.status === 404) {
309
- return [];
316
+ return {
317
+ data: [],
318
+ meta: EMPTY_PAGINATION_INFO
319
+ };
310
320
  }
311
321
  throw new Error(`Failed to fetch sessions: ${response.statusText}`);
312
322
  }
313
323
  const data = await response.json();
314
- return data.data ?? [];
324
+ return {
325
+ data: data.data ?? [],
326
+ meta: data.meta ?? EMPTY_PAGINATION_INFO
327
+ };
315
328
  }
316
329
  /**
317
330
  * Fetch a specific session's runs
@@ -713,7 +726,7 @@ function logChunkParseError(error, jsonString, position) {
713
726
  }
714
727
  console.error("Failed to parse JSON chunk:", {
715
728
  error,
716
- chunk: jsonString.substring(0, 100) + (jsonString.length > 100 ? "..." : ""),
729
+ chunk: jsonString.slice(0, 100) + (jsonString.length > 100 ? "..." : ""),
717
730
  position
718
731
  });
719
732
  }
@@ -1822,7 +1835,7 @@ var AgnoClient = class extends import_eventemitter3.default {
1822
1835
  }
1823
1836
  const headers = this.configManager.buildRequestHeaders();
1824
1837
  const params = this.configManager.buildQueryString(options?.params);
1825
- const sessions = await this.sessionManager.fetchSessions(
1838
+ const response = await this.sessionManager.fetchSessions(
1826
1839
  config.endpoint,
1827
1840
  entityType,
1828
1841
  entityId,
@@ -1830,9 +1843,9 @@ var AgnoClient = class extends import_eventemitter3.default {
1830
1843
  headers,
1831
1844
  params
1832
1845
  );
1833
- this.state.sessions = sessions;
1846
+ this.state.sessions = response.data;
1834
1847
  this.emit("state:change", this.getState());
1835
- return sessions;
1848
+ return response;
1836
1849
  }
1837
1850
  /**
1838
1851
  * Delete a session
package/dist/index.mjs CHANGED
@@ -253,6 +253,13 @@ var ConfigManager = class {
253
253
  };
254
254
 
255
255
  // src/managers/session-manager.ts
256
+ var EMPTY_PAGINATION_INFO = {
257
+ page: 1,
258
+ limit: 0,
259
+ total_pages: 0,
260
+ total_count: 0,
261
+ search_time_ms: 0
262
+ };
256
263
  var SessionManager = class {
257
264
  /**
258
265
  * Fetch all sessions for an entity
@@ -270,12 +277,18 @@ var SessionManager = class {
270
277
  const response = await fetch(url.toString(), { headers });
271
278
  if (!response.ok) {
272
279
  if (response.status === 404) {
273
- return [];
280
+ return {
281
+ data: [],
282
+ meta: EMPTY_PAGINATION_INFO
283
+ };
274
284
  }
275
285
  throw new Error(`Failed to fetch sessions: ${response.statusText}`);
276
286
  }
277
287
  const data = await response.json();
278
- return data.data ?? [];
288
+ return {
289
+ data: data.data ?? [],
290
+ meta: data.meta ?? EMPTY_PAGINATION_INFO
291
+ };
279
292
  }
280
293
  /**
281
294
  * Fetch a specific session's runs
@@ -677,7 +690,7 @@ function logChunkParseError(error, jsonString, position) {
677
690
  }
678
691
  console.error("Failed to parse JSON chunk:", {
679
692
  error,
680
- chunk: jsonString.substring(0, 100) + (jsonString.length > 100 ? "..." : ""),
693
+ chunk: jsonString.slice(0, 100) + (jsonString.length > 100 ? "..." : ""),
681
694
  position
682
695
  });
683
696
  }
@@ -1786,7 +1799,7 @@ var AgnoClient = class extends EventEmitter {
1786
1799
  }
1787
1800
  const headers = this.configManager.buildRequestHeaders();
1788
1801
  const params = this.configManager.buildQueryString(options?.params);
1789
- const sessions = await this.sessionManager.fetchSessions(
1802
+ const response = await this.sessionManager.fetchSessions(
1790
1803
  config.endpoint,
1791
1804
  entityType,
1792
1805
  entityId,
@@ -1794,9 +1807,9 @@ var AgnoClient = class extends EventEmitter {
1794
1807
  headers,
1795
1808
  params
1796
1809
  );
1797
- this.state.sessions = sessions;
1810
+ this.state.sessions = response.data;
1798
1811
  this.emit("state:change", this.getState());
1799
- return sessions;
1812
+ return response;
1800
1813
  }
1801
1814
  /**
1802
1815
  * Delete a session
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antipopp/agno-client",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "Core client library for Agno agents with streaming support and HITL frontend tool execution",
5
5
  "author": "antipopp",
6
6
  "license": "MIT",
@@ -34,7 +34,7 @@
34
34
  ],
35
35
  "dependencies": {
36
36
  "eventemitter3": "^5.0.1",
37
- "@antipopp/agno-types": "0.12.0"
37
+ "@antipopp/agno-types": "0.13.0"
38
38
  },
39
39
  "devDependencies": {
40
40
  "msw": "^2.0.0",