@antipopp/agno-client 0.4.0 → 0.6.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/dist/index.d.mts +9 -5
- package/dist/index.d.ts +9 -5
- package/dist/index.js +15 -62
- package/dist/index.mjs +15 -62
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -60,10 +60,6 @@ declare class AgnoClient extends EventEmitter {
|
|
|
60
60
|
* Delete a session
|
|
61
61
|
*/
|
|
62
62
|
deleteSession(sessionId: string): Promise<void>;
|
|
63
|
-
/**
|
|
64
|
-
* Delete a team session
|
|
65
|
-
*/
|
|
66
|
-
deleteTeamSession(teamId: string, sessionId: string): Promise<void>;
|
|
67
63
|
/**
|
|
68
64
|
* Add tool calls to the last message
|
|
69
65
|
* Used by frontend execution to add tool calls that were executed locally
|
|
@@ -81,7 +77,15 @@ declare class AgnoClient extends EventEmitter {
|
|
|
81
77
|
*/
|
|
82
78
|
private applyPendingUISpecs;
|
|
83
79
|
/**
|
|
84
|
-
* Continue a paused run
|
|
80
|
+
* Continue a paused run with tool execution results.
|
|
81
|
+
*
|
|
82
|
+
* **Note:** HITL (Human-in-the-Loop) frontend tool execution is only supported for agents.
|
|
83
|
+
* Teams do not support the continue endpoint.
|
|
84
|
+
*
|
|
85
|
+
* @param tools - Array of tool calls with execution results
|
|
86
|
+
* @param options - Optional request headers
|
|
87
|
+
* @throws Error if no paused run exists
|
|
88
|
+
* @throws Error if called with team mode (teams don't support HITL)
|
|
85
89
|
*/
|
|
86
90
|
continueRun(tools: ToolCall[], options?: {
|
|
87
91
|
headers?: Record<string, string>;
|
package/dist/index.d.ts
CHANGED
|
@@ -60,10 +60,6 @@ declare class AgnoClient extends EventEmitter {
|
|
|
60
60
|
* Delete a session
|
|
61
61
|
*/
|
|
62
62
|
deleteSession(sessionId: string): Promise<void>;
|
|
63
|
-
/**
|
|
64
|
-
* Delete a team session
|
|
65
|
-
*/
|
|
66
|
-
deleteTeamSession(teamId: string, sessionId: string): Promise<void>;
|
|
67
63
|
/**
|
|
68
64
|
* Add tool calls to the last message
|
|
69
65
|
* Used by frontend execution to add tool calls that were executed locally
|
|
@@ -81,7 +77,15 @@ declare class AgnoClient extends EventEmitter {
|
|
|
81
77
|
*/
|
|
82
78
|
private applyPendingUISpecs;
|
|
83
79
|
/**
|
|
84
|
-
* Continue a paused run
|
|
80
|
+
* Continue a paused run with tool execution results.
|
|
81
|
+
*
|
|
82
|
+
* **Note:** HITL (Human-in-the-Loop) frontend tool execution is only supported for agents.
|
|
83
|
+
* Teams do not support the continue endpoint.
|
|
84
|
+
*
|
|
85
|
+
* @param tools - Array of tool calls with execution results
|
|
86
|
+
* @param options - Optional request headers
|
|
87
|
+
* @throws Error if no paused run exists
|
|
88
|
+
* @throws Error if called with team mode (teams don't support HITL)
|
|
85
89
|
*/
|
|
86
90
|
continueRun(tools: ToolCall[], options?: {
|
|
87
91
|
headers?: Record<string, string>;
|
package/dist/index.js
CHANGED
|
@@ -326,24 +326,6 @@ var SessionManager = class {
|
|
|
326
326
|
throw new Error(`Failed to delete session: ${response.statusText}`);
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
|
-
/**
|
|
330
|
-
* Delete a team session
|
|
331
|
-
* Note: The API route has a typo with double slashes (/v1//teams), keeping it as-is for compatibility
|
|
332
|
-
*/
|
|
333
|
-
async deleteTeamSession(endpoint, teamId, sessionId, authToken) {
|
|
334
|
-
const url = `${endpoint}/v1//teams/${teamId}/sessions/${sessionId}`;
|
|
335
|
-
const headers = {};
|
|
336
|
-
if (authToken) {
|
|
337
|
-
headers["Authorization"] = `Bearer ${authToken}`;
|
|
338
|
-
}
|
|
339
|
-
const response = await fetch(url, {
|
|
340
|
-
method: "DELETE",
|
|
341
|
-
headers
|
|
342
|
-
});
|
|
343
|
-
if (!response.ok) {
|
|
344
|
-
throw new Error(`Failed to delete team session: ${response.statusText}`);
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
329
|
/**
|
|
348
330
|
* Convert session runs array to chat messages
|
|
349
331
|
*/
|
|
@@ -527,28 +509,6 @@ var EventProcessor = class {
|
|
|
527
509
|
references: chunk.extra_data.references
|
|
528
510
|
};
|
|
529
511
|
}
|
|
530
|
-
if (chunk.extra_data?.generated_ui) {
|
|
531
|
-
const existingUI = updatedMessage.extra_data?.generated_ui ?? [];
|
|
532
|
-
const incomingUI = chunk.extra_data.generated_ui;
|
|
533
|
-
const mergedUI = [...existingUI];
|
|
534
|
-
for (const uiData of incomingUI) {
|
|
535
|
-
const existingIndex = mergedUI.findIndex(
|
|
536
|
-
(ui) => ui.tool_call_id === uiData.tool_call_id
|
|
537
|
-
);
|
|
538
|
-
if (existingIndex >= 0) {
|
|
539
|
-
mergedUI[existingIndex] = {
|
|
540
|
-
...mergedUI[existingIndex],
|
|
541
|
-
...uiData
|
|
542
|
-
};
|
|
543
|
-
} else {
|
|
544
|
-
mergedUI.push(uiData);
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
updatedMessage.extra_data = {
|
|
548
|
-
...updatedMessage.extra_data,
|
|
549
|
-
generated_ui: mergedUI
|
|
550
|
-
};
|
|
551
|
-
}
|
|
552
512
|
updatedMessage.created_at = chunk.created_at ?? lastMessage.created_at;
|
|
553
513
|
if (chunk.images) {
|
|
554
514
|
updatedMessage.images = chunk.images;
|
|
@@ -608,8 +568,7 @@ var EventProcessor = class {
|
|
|
608
568
|
updatedMessage.created_at = chunk.created_at ?? lastMessage.created_at;
|
|
609
569
|
updatedMessage.extra_data = {
|
|
610
570
|
reasoning_steps: chunk.extra_data?.reasoning_steps ?? lastMessage.extra_data?.reasoning_steps,
|
|
611
|
-
references: chunk.extra_data?.references ?? lastMessage.extra_data?.references
|
|
612
|
-
generated_ui: chunk.extra_data?.generated_ui ?? lastMessage.extra_data?.generated_ui
|
|
571
|
+
references: chunk.extra_data?.references ?? lastMessage.extra_data?.references
|
|
613
572
|
};
|
|
614
573
|
break;
|
|
615
574
|
case import_agno_types.RunEvent.UpdatingMemory:
|
|
@@ -1148,25 +1107,6 @@ var AgnoClient = class extends import_eventemitter3.default {
|
|
|
1148
1107
|
}
|
|
1149
1108
|
this.emit("state:change", this.getState());
|
|
1150
1109
|
}
|
|
1151
|
-
/**
|
|
1152
|
-
* Delete a team session
|
|
1153
|
-
*/
|
|
1154
|
-
async deleteTeamSession(teamId, sessionId) {
|
|
1155
|
-
const config = this.configManager.getConfig();
|
|
1156
|
-
await this.sessionManager.deleteTeamSession(
|
|
1157
|
-
config.endpoint,
|
|
1158
|
-
teamId,
|
|
1159
|
-
sessionId,
|
|
1160
|
-
config.authToken
|
|
1161
|
-
);
|
|
1162
|
-
this.state.sessions = this.state.sessions.filter(
|
|
1163
|
-
(s) => s.session_id !== sessionId
|
|
1164
|
-
);
|
|
1165
|
-
if (this.configManager.getSessionId() === sessionId) {
|
|
1166
|
-
this.clearMessages();
|
|
1167
|
-
}
|
|
1168
|
-
this.emit("state:change", this.getState());
|
|
1169
|
-
}
|
|
1170
1110
|
/**
|
|
1171
1111
|
* Add tool calls to the last message
|
|
1172
1112
|
* Used by frontend execution to add tool calls that were executed locally
|
|
@@ -1265,9 +1205,22 @@ var AgnoClient = class extends import_eventemitter3.default {
|
|
|
1265
1205
|
}
|
|
1266
1206
|
}
|
|
1267
1207
|
/**
|
|
1268
|
-
* Continue a paused run
|
|
1208
|
+
* Continue a paused run with tool execution results.
|
|
1209
|
+
*
|
|
1210
|
+
* **Note:** HITL (Human-in-the-Loop) frontend tool execution is only supported for agents.
|
|
1211
|
+
* Teams do not support the continue endpoint.
|
|
1212
|
+
*
|
|
1213
|
+
* @param tools - Array of tool calls with execution results
|
|
1214
|
+
* @param options - Optional request headers
|
|
1215
|
+
* @throws Error if no paused run exists
|
|
1216
|
+
* @throws Error if called with team mode (teams don't support HITL)
|
|
1269
1217
|
*/
|
|
1270
1218
|
async continueRun(tools, options) {
|
|
1219
|
+
if (this.configManager.getMode() === "team") {
|
|
1220
|
+
throw new Error(
|
|
1221
|
+
"HITL (Human-in-the-Loop) frontend tool execution is not supported for teams. Only agents support the continue endpoint."
|
|
1222
|
+
);
|
|
1223
|
+
}
|
|
1271
1224
|
if (!this.state.isPaused || !this.state.pausedRunId) {
|
|
1272
1225
|
throw new Error("No paused run to continue");
|
|
1273
1226
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -288,24 +288,6 @@ var SessionManager = class {
|
|
|
288
288
|
throw new Error(`Failed to delete session: ${response.statusText}`);
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
|
-
/**
|
|
292
|
-
* Delete a team session
|
|
293
|
-
* Note: The API route has a typo with double slashes (/v1//teams), keeping it as-is for compatibility
|
|
294
|
-
*/
|
|
295
|
-
async deleteTeamSession(endpoint, teamId, sessionId, authToken) {
|
|
296
|
-
const url = `${endpoint}/v1//teams/${teamId}/sessions/${sessionId}`;
|
|
297
|
-
const headers = {};
|
|
298
|
-
if (authToken) {
|
|
299
|
-
headers["Authorization"] = `Bearer ${authToken}`;
|
|
300
|
-
}
|
|
301
|
-
const response = await fetch(url, {
|
|
302
|
-
method: "DELETE",
|
|
303
|
-
headers
|
|
304
|
-
});
|
|
305
|
-
if (!response.ok) {
|
|
306
|
-
throw new Error(`Failed to delete team session: ${response.statusText}`);
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
291
|
/**
|
|
310
292
|
* Convert session runs array to chat messages
|
|
311
293
|
*/
|
|
@@ -489,28 +471,6 @@ var EventProcessor = class {
|
|
|
489
471
|
references: chunk.extra_data.references
|
|
490
472
|
};
|
|
491
473
|
}
|
|
492
|
-
if (chunk.extra_data?.generated_ui) {
|
|
493
|
-
const existingUI = updatedMessage.extra_data?.generated_ui ?? [];
|
|
494
|
-
const incomingUI = chunk.extra_data.generated_ui;
|
|
495
|
-
const mergedUI = [...existingUI];
|
|
496
|
-
for (const uiData of incomingUI) {
|
|
497
|
-
const existingIndex = mergedUI.findIndex(
|
|
498
|
-
(ui) => ui.tool_call_id === uiData.tool_call_id
|
|
499
|
-
);
|
|
500
|
-
if (existingIndex >= 0) {
|
|
501
|
-
mergedUI[existingIndex] = {
|
|
502
|
-
...mergedUI[existingIndex],
|
|
503
|
-
...uiData
|
|
504
|
-
};
|
|
505
|
-
} else {
|
|
506
|
-
mergedUI.push(uiData);
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
updatedMessage.extra_data = {
|
|
510
|
-
...updatedMessage.extra_data,
|
|
511
|
-
generated_ui: mergedUI
|
|
512
|
-
};
|
|
513
|
-
}
|
|
514
474
|
updatedMessage.created_at = chunk.created_at ?? lastMessage.created_at;
|
|
515
475
|
if (chunk.images) {
|
|
516
476
|
updatedMessage.images = chunk.images;
|
|
@@ -570,8 +530,7 @@ var EventProcessor = class {
|
|
|
570
530
|
updatedMessage.created_at = chunk.created_at ?? lastMessage.created_at;
|
|
571
531
|
updatedMessage.extra_data = {
|
|
572
532
|
reasoning_steps: chunk.extra_data?.reasoning_steps ?? lastMessage.extra_data?.reasoning_steps,
|
|
573
|
-
references: chunk.extra_data?.references ?? lastMessage.extra_data?.references
|
|
574
|
-
generated_ui: chunk.extra_data?.generated_ui ?? lastMessage.extra_data?.generated_ui
|
|
533
|
+
references: chunk.extra_data?.references ?? lastMessage.extra_data?.references
|
|
575
534
|
};
|
|
576
535
|
break;
|
|
577
536
|
case RunEventEnum.UpdatingMemory:
|
|
@@ -1110,25 +1069,6 @@ var AgnoClient = class extends EventEmitter {
|
|
|
1110
1069
|
}
|
|
1111
1070
|
this.emit("state:change", this.getState());
|
|
1112
1071
|
}
|
|
1113
|
-
/**
|
|
1114
|
-
* Delete a team session
|
|
1115
|
-
*/
|
|
1116
|
-
async deleteTeamSession(teamId, sessionId) {
|
|
1117
|
-
const config = this.configManager.getConfig();
|
|
1118
|
-
await this.sessionManager.deleteTeamSession(
|
|
1119
|
-
config.endpoint,
|
|
1120
|
-
teamId,
|
|
1121
|
-
sessionId,
|
|
1122
|
-
config.authToken
|
|
1123
|
-
);
|
|
1124
|
-
this.state.sessions = this.state.sessions.filter(
|
|
1125
|
-
(s) => s.session_id !== sessionId
|
|
1126
|
-
);
|
|
1127
|
-
if (this.configManager.getSessionId() === sessionId) {
|
|
1128
|
-
this.clearMessages();
|
|
1129
|
-
}
|
|
1130
|
-
this.emit("state:change", this.getState());
|
|
1131
|
-
}
|
|
1132
1072
|
/**
|
|
1133
1073
|
* Add tool calls to the last message
|
|
1134
1074
|
* Used by frontend execution to add tool calls that were executed locally
|
|
@@ -1227,9 +1167,22 @@ var AgnoClient = class extends EventEmitter {
|
|
|
1227
1167
|
}
|
|
1228
1168
|
}
|
|
1229
1169
|
/**
|
|
1230
|
-
* Continue a paused run
|
|
1170
|
+
* Continue a paused run with tool execution results.
|
|
1171
|
+
*
|
|
1172
|
+
* **Note:** HITL (Human-in-the-Loop) frontend tool execution is only supported for agents.
|
|
1173
|
+
* Teams do not support the continue endpoint.
|
|
1174
|
+
*
|
|
1175
|
+
* @param tools - Array of tool calls with execution results
|
|
1176
|
+
* @param options - Optional request headers
|
|
1177
|
+
* @throws Error if no paused run exists
|
|
1178
|
+
* @throws Error if called with team mode (teams don't support HITL)
|
|
1231
1179
|
*/
|
|
1232
1180
|
async continueRun(tools, options) {
|
|
1181
|
+
if (this.configManager.getMode() === "team") {
|
|
1182
|
+
throw new Error(
|
|
1183
|
+
"HITL (Human-in-the-Loop) frontend tool execution is not supported for teams. Only agents support the continue endpoint."
|
|
1184
|
+
);
|
|
1185
|
+
}
|
|
1233
1186
|
if (!this.state.isPaused || !this.state.pausedRunId) {
|
|
1234
1187
|
throw new Error("No paused run to continue");
|
|
1235
1188
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antipopp/agno-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.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.
|
|
37
|
+
"@antipopp/agno-types": "0.6.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"tsup": "^8.0.1",
|