agent-swarm-kit 1.0.73 → 1.0.75
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/build/index.cjs +721 -403
- package/build/index.mjs +714 -404
- package/package.json +2 -2
- package/types.d.ts +143 -50
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-swarm-kit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.75",
|
|
4
4
|
"description": "A TypeScript library for building orchestrated framework-agnostic multi-agent AI systems",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Petr Tripolsky",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
75
|
"di-kit": "^1.0.12",
|
|
76
|
-
"di-scoped": "^1.0.
|
|
76
|
+
"di-scoped": "^1.0.12",
|
|
77
77
|
"functools-kit": "^1.0.74",
|
|
78
78
|
"lodash-es": "4.17.21",
|
|
79
79
|
"xml2js": "0.6.2"
|
package/types.d.ts
CHANGED
|
@@ -412,6 +412,10 @@ interface IBusEventContext {
|
|
|
412
412
|
* Type representing the possible sources of an event.
|
|
413
413
|
*/
|
|
414
414
|
type EventSource = string;
|
|
415
|
+
/**
|
|
416
|
+
* Type representing the possible sources of an event for the internal bus.
|
|
417
|
+
*/
|
|
418
|
+
type EventBusSource = "agent-bus" | "history-bus" | "session-bus" | "state-bus" | "storage-bus" | "swarm-bus";
|
|
415
419
|
/**
|
|
416
420
|
* Interface representing the base structure of an event.
|
|
417
421
|
*/
|
|
@@ -425,7 +429,13 @@ interface IBaseEvent {
|
|
|
425
429
|
*/
|
|
426
430
|
clientId: string;
|
|
427
431
|
}
|
|
428
|
-
interface IBusEvent extends IBaseEvent {
|
|
432
|
+
interface IBusEvent extends Omit<IBaseEvent, keyof {
|
|
433
|
+
source: never;
|
|
434
|
+
}> {
|
|
435
|
+
/**
|
|
436
|
+
* The source of the event.
|
|
437
|
+
*/
|
|
438
|
+
source: EventBusSource;
|
|
429
439
|
/**
|
|
430
440
|
* The type of the event.
|
|
431
441
|
*/
|
|
@@ -450,7 +460,18 @@ interface ICustomEvent<T extends any = any> extends IBaseEvent {
|
|
|
450
460
|
payload?: T;
|
|
451
461
|
}
|
|
452
462
|
|
|
463
|
+
/**
|
|
464
|
+
* Interface representing a Bus.
|
|
465
|
+
*/
|
|
453
466
|
interface IBus {
|
|
467
|
+
/**
|
|
468
|
+
* Emits an event to a specific client.
|
|
469
|
+
*
|
|
470
|
+
* @template T - The type of event extending IBaseEvent.
|
|
471
|
+
* @param {string} clientId - The ID of the client to emit the event to.
|
|
472
|
+
* @param {T} event - The event to emit.
|
|
473
|
+
* @returns {Promise<void>} A promise that resolves when the event has been emitted.
|
|
474
|
+
*/
|
|
454
475
|
emit<T extends IBaseEvent>(clientId: string, event: T): Promise<void>;
|
|
455
476
|
}
|
|
456
477
|
|
|
@@ -1402,6 +1423,7 @@ type ToolName = string;
|
|
|
1402
1423
|
*/
|
|
1403
1424
|
interface IContext {
|
|
1404
1425
|
clientId: string;
|
|
1426
|
+
requestId: string;
|
|
1405
1427
|
agentName: AgentName;
|
|
1406
1428
|
swarmName: SwarmName;
|
|
1407
1429
|
storageName: StorageName;
|
|
@@ -1423,6 +1445,7 @@ declare const ContextService: (new () => {
|
|
|
1423
1445
|
* Provides methods to log and debug messages.
|
|
1424
1446
|
*/
|
|
1425
1447
|
declare class LoggerService implements ILogger {
|
|
1448
|
+
private readonly contextService;
|
|
1426
1449
|
private _logger;
|
|
1427
1450
|
/**
|
|
1428
1451
|
* Logs messages using the current logger.
|
|
@@ -2003,7 +2026,7 @@ declare class AgentPublicService implements TAgentConnectionService {
|
|
|
2003
2026
|
* @param {AgentName} agentName - The name of the agent.
|
|
2004
2027
|
* @returns {Promise<unknown>} The agent reference.
|
|
2005
2028
|
*/
|
|
2006
|
-
createAgentRef: (clientId: string, agentName: AgentName) => Promise<ClientAgent>;
|
|
2029
|
+
createAgentRef: (requestId: string, clientId: string, agentName: AgentName) => Promise<ClientAgent>;
|
|
2007
2030
|
/**
|
|
2008
2031
|
* Executes a command on the agent.
|
|
2009
2032
|
* @param {string} input - The input command.
|
|
@@ -2011,14 +2034,14 @@ declare class AgentPublicService implements TAgentConnectionService {
|
|
|
2011
2034
|
* @param {AgentName} agentName - The name of the agent.
|
|
2012
2035
|
* @returns {Promise<unknown>} The execution result.
|
|
2013
2036
|
*/
|
|
2014
|
-
execute: (input: string, mode: ExecutionMode, clientId: string, agentName: AgentName) => Promise<void>;
|
|
2037
|
+
execute: (input: string, mode: ExecutionMode, requestId: string, clientId: string, agentName: AgentName) => Promise<void>;
|
|
2015
2038
|
/**
|
|
2016
2039
|
* Waits for the agent's output.
|
|
2017
2040
|
* @param {string} clientId - The client ID.
|
|
2018
2041
|
* @param {AgentName} agentName - The name of the agent.
|
|
2019
2042
|
* @returns {Promise<unknown>} The output result.
|
|
2020
2043
|
*/
|
|
2021
|
-
waitForOutput: (clientId: string, agentName: AgentName) => Promise<string>;
|
|
2044
|
+
waitForOutput: (requestId: string, clientId: string, agentName: AgentName) => Promise<string>;
|
|
2022
2045
|
/**
|
|
2023
2046
|
* Commits tool output to the agent.
|
|
2024
2047
|
* @param {string} toolId - The `tool_call_id` for openai history
|
|
@@ -2027,7 +2050,7 @@ declare class AgentPublicService implements TAgentConnectionService {
|
|
|
2027
2050
|
* @param {AgentName} agentName - The name of the agent.
|
|
2028
2051
|
* @returns {Promise<unknown>} The commit result.
|
|
2029
2052
|
*/
|
|
2030
|
-
commitToolOutput: (toolId: string, content: string, clientId: string, agentName: AgentName) => Promise<void>;
|
|
2053
|
+
commitToolOutput: (toolId: string, content: string, requestId: string, clientId: string, agentName: AgentName) => Promise<void>;
|
|
2031
2054
|
/**
|
|
2032
2055
|
* Commits a system message to the agent.
|
|
2033
2056
|
* @param {string} message - The message to commit.
|
|
@@ -2035,7 +2058,7 @@ declare class AgentPublicService implements TAgentConnectionService {
|
|
|
2035
2058
|
* @param {AgentName} agentName - The name of the agent.
|
|
2036
2059
|
* @returns {Promise<unknown>} The commit result.
|
|
2037
2060
|
*/
|
|
2038
|
-
commitSystemMessage: (message: string, clientId: string, agentName: AgentName) => Promise<void>;
|
|
2061
|
+
commitSystemMessage: (message: string, requestId: string, clientId: string, agentName: AgentName) => Promise<void>;
|
|
2039
2062
|
/**
|
|
2040
2063
|
* Commits user message to the agent without answer.
|
|
2041
2064
|
* @param {string} message - The message to commit.
|
|
@@ -2043,28 +2066,28 @@ declare class AgentPublicService implements TAgentConnectionService {
|
|
|
2043
2066
|
* @param {AgentName} agentName - The name of the agent.
|
|
2044
2067
|
* @returns {Promise<unknown>} The commit result.
|
|
2045
2068
|
*/
|
|
2046
|
-
commitUserMessage: (message: string, clientId: string, agentName: AgentName) => Promise<void>;
|
|
2069
|
+
commitUserMessage: (message: string, requestId: string, clientId: string, agentName: AgentName) => Promise<void>;
|
|
2047
2070
|
/**
|
|
2048
2071
|
* Commits flush of agent history
|
|
2049
2072
|
* @param {string} clientId - The client ID.
|
|
2050
2073
|
* @param {AgentName} agentName - The name of the agent.
|
|
2051
2074
|
* @returns {Promise<unknown>} The commit result.
|
|
2052
2075
|
*/
|
|
2053
|
-
commitFlush: (clientId: string, agentName: AgentName) => Promise<void>;
|
|
2076
|
+
commitFlush: (requestId: string, clientId: string, agentName: AgentName) => Promise<void>;
|
|
2054
2077
|
/**
|
|
2055
2078
|
* Commits change of agent to prevent the next tool execution from being called.
|
|
2056
2079
|
* @param {string} clientId - The client ID.
|
|
2057
2080
|
* @param {AgentName} agentName - The name of the agent.
|
|
2058
2081
|
* @returns {Promise<unknown>} The commit result.
|
|
2059
2082
|
*/
|
|
2060
|
-
commitAgentChange: (clientId: string, agentName: AgentName) => Promise<void>;
|
|
2083
|
+
commitAgentChange: (requestId: string, clientId: string, agentName: AgentName) => Promise<void>;
|
|
2061
2084
|
/**
|
|
2062
2085
|
* Disposes of the agent.
|
|
2063
2086
|
* @param {string} clientId - The client ID.
|
|
2064
2087
|
* @param {AgentName} agentName - The name of the agent.
|
|
2065
2088
|
* @returns {Promise<unknown>} The dispose result.
|
|
2066
2089
|
*/
|
|
2067
|
-
dispose: (clientId: string, agentName: AgentName) => Promise<void>;
|
|
2090
|
+
dispose: (requestId: string, clientId: string, agentName: AgentName) => Promise<void>;
|
|
2068
2091
|
}
|
|
2069
2092
|
|
|
2070
2093
|
interface IHistoryConnectionService extends HistoryConnectionService {
|
|
@@ -2089,7 +2112,7 @@ declare class HistoryPublicService implements THistoryConnectionService {
|
|
|
2089
2112
|
* @param {AgentName} agentName - The agent name.
|
|
2090
2113
|
* @returns {Promise<void>} A promise that resolves when the operation is complete.
|
|
2091
2114
|
*/
|
|
2092
|
-
push: (message: IModelMessage, clientId: string, agentName: AgentName) => Promise<void>;
|
|
2115
|
+
push: (message: IModelMessage, requestId: string, clientId: string, agentName: AgentName) => Promise<void>;
|
|
2093
2116
|
/**
|
|
2094
2117
|
* Converts history to an array for a specific agent.
|
|
2095
2118
|
* @param {string} prompt - The prompt.
|
|
@@ -2097,21 +2120,21 @@ declare class HistoryPublicService implements THistoryConnectionService {
|
|
|
2097
2120
|
* @param {AgentName} agentName - The agent name.
|
|
2098
2121
|
* @returns {Promise<any[]>} A promise that resolves to an array of history items.
|
|
2099
2122
|
*/
|
|
2100
|
-
toArrayForAgent: (prompt: string, clientId: string, agentName: AgentName) => Promise<IModelMessage[]>;
|
|
2123
|
+
toArrayForAgent: (prompt: string, requestId: string, clientId: string, agentName: AgentName) => Promise<IModelMessage[]>;
|
|
2101
2124
|
/**
|
|
2102
2125
|
* Converts history to a raw array.
|
|
2103
2126
|
* @param {string} clientId - The client ID.
|
|
2104
2127
|
* @param {AgentName} agentName - The agent name.
|
|
2105
2128
|
* @returns {Promise<any[]>} A promise that resolves to a raw array of history items.
|
|
2106
2129
|
*/
|
|
2107
|
-
toArrayForRaw: (clientId: string, agentName: AgentName) => Promise<IModelMessage[]>;
|
|
2130
|
+
toArrayForRaw: (requestId: string, clientId: string, agentName: AgentName) => Promise<IModelMessage[]>;
|
|
2108
2131
|
/**
|
|
2109
2132
|
* Disposes of the history.
|
|
2110
2133
|
* @param {string} clientId - The client ID.
|
|
2111
2134
|
* @param {AgentName} agentName - The agent name.
|
|
2112
2135
|
* @returns {Promise<void>} A promise that resolves when the operation is complete.
|
|
2113
2136
|
*/
|
|
2114
|
-
dispose: (clientId: string, agentName: AgentName) => Promise<void>;
|
|
2137
|
+
dispose: (requestId: string, clientId: string, agentName: AgentName) => Promise<void>;
|
|
2115
2138
|
}
|
|
2116
2139
|
|
|
2117
2140
|
interface ISessionConnectionService extends SessionConnectionService {
|
|
@@ -2135,7 +2158,7 @@ declare class SessionPublicService implements TSessionConnectionService {
|
|
|
2135
2158
|
* @param {SwarmName} swarmName - The swarm name.
|
|
2136
2159
|
* @returns {Promise<void>}
|
|
2137
2160
|
*/
|
|
2138
|
-
emit: (content: string, clientId: string, swarmName: SwarmName) => Promise<void>;
|
|
2161
|
+
emit: (content: string, requestId: string, clientId: string, swarmName: SwarmName) => Promise<void>;
|
|
2139
2162
|
/**
|
|
2140
2163
|
* Executes a command in the session.
|
|
2141
2164
|
* @param {string} content - The content to execute.
|
|
@@ -2143,7 +2166,7 @@ declare class SessionPublicService implements TSessionConnectionService {
|
|
|
2143
2166
|
* @param {SwarmName} swarmName - The swarm name.
|
|
2144
2167
|
* @returns {Promise<void>}
|
|
2145
2168
|
*/
|
|
2146
|
-
execute: (content: string, mode: ExecutionMode, clientId: string, swarmName: SwarmName) => Promise<string>;
|
|
2169
|
+
execute: (content: string, mode: ExecutionMode, requestId: string, clientId: string, swarmName: SwarmName) => Promise<string>;
|
|
2147
2170
|
/**
|
|
2148
2171
|
* Connects to the session.
|
|
2149
2172
|
* @param {SendMessageFn} connector - The function to send messages.
|
|
@@ -2151,7 +2174,7 @@ declare class SessionPublicService implements TSessionConnectionService {
|
|
|
2151
2174
|
* @param {SwarmName} swarmName - The swarm name.
|
|
2152
2175
|
* @returns {ReceiveMessageFn}
|
|
2153
2176
|
*/
|
|
2154
|
-
connect: (connector: SendMessageFn$1, clientId: string, swarmName: SwarmName) => ReceiveMessageFn;
|
|
2177
|
+
connect: (connector: SendMessageFn$1, requestId: string, clientId: string, swarmName: SwarmName) => ReceiveMessageFn;
|
|
2155
2178
|
/**
|
|
2156
2179
|
* Commits tool output to the session.
|
|
2157
2180
|
* @param {string} toolId - The `tool_call_id` for openai history
|
|
@@ -2160,7 +2183,7 @@ declare class SessionPublicService implements TSessionConnectionService {
|
|
|
2160
2183
|
* @param {SwarmName} swarmName - The swarm name.
|
|
2161
2184
|
* @returns {Promise<void>}
|
|
2162
2185
|
*/
|
|
2163
|
-
commitToolOutput: (toolId: string, content: string, clientId: string, swarmName: SwarmName) => Promise<void>;
|
|
2186
|
+
commitToolOutput: (toolId: string, content: string, requestId: string, clientId: string, swarmName: SwarmName) => Promise<void>;
|
|
2164
2187
|
/**
|
|
2165
2188
|
* Commits a system message to the session.
|
|
2166
2189
|
* @param {string} message - The message to commit.
|
|
@@ -2168,7 +2191,7 @@ declare class SessionPublicService implements TSessionConnectionService {
|
|
|
2168
2191
|
* @param {SwarmName} swarmName - The swarm name.
|
|
2169
2192
|
* @returns {Promise<void>}
|
|
2170
2193
|
*/
|
|
2171
|
-
commitSystemMessage: (message: string, clientId: string, swarmName: SwarmName) => Promise<void>;
|
|
2194
|
+
commitSystemMessage: (message: string, requestId: string, clientId: string, swarmName: SwarmName) => Promise<void>;
|
|
2172
2195
|
/**
|
|
2173
2196
|
* Commits user message to the agent without answer.
|
|
2174
2197
|
* @param {string} message - The message to commit.
|
|
@@ -2176,21 +2199,21 @@ declare class SessionPublicService implements TSessionConnectionService {
|
|
|
2176
2199
|
* @param {SwarmName} swarmName - The swarm name.
|
|
2177
2200
|
* @returns {Promise<void>}
|
|
2178
2201
|
*/
|
|
2179
|
-
commitUserMessage: (message: string, clientId: string, swarmName: SwarmName) => Promise<void>;
|
|
2202
|
+
commitUserMessage: (message: string, requestId: string, clientId: string, swarmName: SwarmName) => Promise<void>;
|
|
2180
2203
|
/**
|
|
2181
2204
|
* Commits flush of agent history
|
|
2182
2205
|
* @param {string} clientId - The client ID.
|
|
2183
2206
|
* @param {SwarmName} swarmName - The swarm name.
|
|
2184
2207
|
* @returns {Promise<void>}
|
|
2185
2208
|
*/
|
|
2186
|
-
commitFlush: (clientId: string, swarmName: SwarmName) => Promise<void>;
|
|
2209
|
+
commitFlush: (requestId: string, clientId: string, swarmName: SwarmName) => Promise<void>;
|
|
2187
2210
|
/**
|
|
2188
2211
|
* Disposes of the session.
|
|
2189
2212
|
* @param {string} clientId - The client ID.
|
|
2190
2213
|
* @param {SwarmName} swarmName - The swarm name.
|
|
2191
2214
|
* @returns {Promise<void>}
|
|
2192
2215
|
*/
|
|
2193
|
-
dispose: (clientId: string, swarmName: SwarmName) => Promise<void>;
|
|
2216
|
+
dispose: (requestId: string, clientId: string, swarmName: SwarmName) => Promise<void>;
|
|
2194
2217
|
}
|
|
2195
2218
|
|
|
2196
2219
|
interface ISwarmConnectionService extends SwarmConnectionService {
|
|
@@ -2213,28 +2236,28 @@ declare class SwarmPublicService implements TSwarmConnectionService {
|
|
|
2213
2236
|
* @param {SwarmName} swarmName - The swarm name.
|
|
2214
2237
|
* @returns {Promise<void>}
|
|
2215
2238
|
*/
|
|
2216
|
-
cancelOutput: (clientId: string, swarmName: SwarmName) => Promise<void>;
|
|
2239
|
+
cancelOutput: (requestId: string, clientId: string, swarmName: SwarmName) => Promise<void>;
|
|
2217
2240
|
/**
|
|
2218
2241
|
* Waits for output from the swarm.
|
|
2219
2242
|
* @param {string} clientId - The client ID.
|
|
2220
2243
|
* @param {SwarmName} swarmName - The swarm name.
|
|
2221
2244
|
* @returns {Promise<void>}
|
|
2222
2245
|
*/
|
|
2223
|
-
waitForOutput: (clientId: string, swarmName: SwarmName) => Promise<string>;
|
|
2246
|
+
waitForOutput: (requestId: string, clientId: string, swarmName: SwarmName) => Promise<string>;
|
|
2224
2247
|
/**
|
|
2225
2248
|
* Gets the agent name from the swarm.
|
|
2226
2249
|
* @param {string} clientId - The client ID.
|
|
2227
2250
|
* @param {SwarmName} swarmName - The swarm name.
|
|
2228
2251
|
* @returns {Promise<string>}
|
|
2229
2252
|
*/
|
|
2230
|
-
getAgentName: (clientId: string, swarmName: SwarmName) => Promise<string>;
|
|
2253
|
+
getAgentName: (requestId: string, clientId: string, swarmName: SwarmName) => Promise<string>;
|
|
2231
2254
|
/**
|
|
2232
2255
|
* Gets the agent from the swarm.
|
|
2233
2256
|
* @param {string} clientId - The client ID.
|
|
2234
2257
|
* @param {SwarmName} swarmName - The swarm name.
|
|
2235
2258
|
* @returns {Promise<IAgent>}
|
|
2236
2259
|
*/
|
|
2237
|
-
getAgent: (clientId: string, swarmName: SwarmName) => Promise<IAgent>;
|
|
2260
|
+
getAgent: (requestId: string, clientId: string, swarmName: SwarmName) => Promise<IAgent>;
|
|
2238
2261
|
/**
|
|
2239
2262
|
* Sets the agent reference in the swarm.
|
|
2240
2263
|
* @param {string} clientId - The client ID.
|
|
@@ -2243,7 +2266,7 @@ declare class SwarmPublicService implements TSwarmConnectionService {
|
|
|
2243
2266
|
* @param {IAgent} agent - The agent instance.
|
|
2244
2267
|
* @returns {Promise<void>}
|
|
2245
2268
|
*/
|
|
2246
|
-
setAgentRef: (clientId: string, swarmName: SwarmName, agentName: AgentName, agent: IAgent) => Promise<void>;
|
|
2269
|
+
setAgentRef: (requestId: string, clientId: string, swarmName: SwarmName, agentName: AgentName, agent: IAgent) => Promise<void>;
|
|
2247
2270
|
/**
|
|
2248
2271
|
* Sets the agent name in the swarm.
|
|
2249
2272
|
* @param {AgentName} agentName - The agent name.
|
|
@@ -2251,14 +2274,14 @@ declare class SwarmPublicService implements TSwarmConnectionService {
|
|
|
2251
2274
|
* @param {SwarmName} swarmName - The swarm name.
|
|
2252
2275
|
* @returns {Promise<void>}
|
|
2253
2276
|
*/
|
|
2254
|
-
setAgentName: (agentName: AgentName, clientId: string, swarmName: SwarmName) => Promise<void>;
|
|
2277
|
+
setAgentName: (agentName: AgentName, requestId: string, clientId: string, swarmName: SwarmName) => Promise<void>;
|
|
2255
2278
|
/**
|
|
2256
2279
|
* Disposes of the swarm.
|
|
2257
2280
|
* @param {string} clientId - The client ID.
|
|
2258
2281
|
* @param {SwarmName} swarmName - The swarm name.
|
|
2259
2282
|
* @returns {Promise<void>}
|
|
2260
2283
|
*/
|
|
2261
|
-
dispose: (clientId: string, swarmName: SwarmName) => Promise<void>;
|
|
2284
|
+
dispose: (requestId: string, clientId: string, swarmName: SwarmName) => Promise<void>;
|
|
2262
2285
|
}
|
|
2263
2286
|
|
|
2264
2287
|
/**
|
|
@@ -2698,43 +2721,43 @@ declare class StoragePublicService implements TStorageConnectionService {
|
|
|
2698
2721
|
* @param {number} total - The total number of items to retrieve.
|
|
2699
2722
|
* @returns {Promise<IStorageData[]>} The list of storage data.
|
|
2700
2723
|
*/
|
|
2701
|
-
take: (search: string, total: number, clientId: string, storageName: StorageName, score?: number) => Promise<IStorageData[]>;
|
|
2724
|
+
take: (search: string, total: number, requestId: string, clientId: string, storageName: StorageName, score?: number) => Promise<IStorageData[]>;
|
|
2702
2725
|
/**
|
|
2703
2726
|
* Upserts an item in the storage.
|
|
2704
2727
|
* @param {IStorageData} item - The item to upsert.
|
|
2705
2728
|
* @returns {Promise<void>}
|
|
2706
2729
|
*/
|
|
2707
|
-
upsert: (item: IStorageData, clientId: string, storageName: StorageName) => Promise<void>;
|
|
2730
|
+
upsert: (item: IStorageData, requestId: string, clientId: string, storageName: StorageName) => Promise<void>;
|
|
2708
2731
|
/**
|
|
2709
2732
|
* Removes an item from the storage.
|
|
2710
2733
|
* @param {IStorageData["id"]} itemId - The ID of the item to remove.
|
|
2711
2734
|
* @returns {Promise<void>}
|
|
2712
2735
|
*/
|
|
2713
|
-
remove: (itemId: IStorageData["id"], clientId: string, storageName: StorageName) => Promise<void>;
|
|
2736
|
+
remove: (itemId: IStorageData["id"], requestId: string, clientId: string, storageName: StorageName) => Promise<void>;
|
|
2714
2737
|
/**
|
|
2715
2738
|
* Retrieves an item from the storage by its ID.
|
|
2716
2739
|
* @param {IStorageData["id"]} itemId - The ID of the item to retrieve.
|
|
2717
2740
|
* @returns {Promise<IStorageData>} The retrieved item.
|
|
2718
2741
|
*/
|
|
2719
|
-
get: (itemId: IStorageData["id"], clientId: string, storageName: StorageName) => Promise<IStorageData | null>;
|
|
2742
|
+
get: (itemId: IStorageData["id"], requestId: string, clientId: string, storageName: StorageName) => Promise<IStorageData | null>;
|
|
2720
2743
|
/**
|
|
2721
2744
|
* Retrieves a list of items from the storage, optionally filtered by a predicate function.
|
|
2722
2745
|
* @param {function(IStorageData): boolean} [filter] - The optional filter function.
|
|
2723
2746
|
* @returns {Promise<IStorageData[]>} The list of items.
|
|
2724
2747
|
*/
|
|
2725
|
-
list: (clientId: string, storageName: StorageName, filter?: (item: IStorageData) => boolean) => Promise<IStorageData[]>;
|
|
2748
|
+
list: (requestId: string, clientId: string, storageName: StorageName, filter?: (item: IStorageData) => boolean) => Promise<IStorageData[]>;
|
|
2726
2749
|
/**
|
|
2727
2750
|
* Clears all items from the storage.
|
|
2728
2751
|
* @returns {Promise<void>}
|
|
2729
2752
|
*/
|
|
2730
|
-
clear: (clientId: string, storageName: StorageName) => Promise<void>;
|
|
2753
|
+
clear: (requestId: string, clientId: string, storageName: StorageName) => Promise<void>;
|
|
2731
2754
|
/**
|
|
2732
2755
|
* Disposes of the storage.
|
|
2733
2756
|
* @param {string} clientId - The client ID.
|
|
2734
2757
|
* @param {StorageName} storageName - The storage name.
|
|
2735
2758
|
* @returns {Promise<void>}
|
|
2736
2759
|
*/
|
|
2737
|
-
dispose: (clientId: string, storageName: StorageName) => Promise<void>;
|
|
2760
|
+
dispose: (requestId: string, clientId: string, storageName: StorageName) => Promise<void>;
|
|
2738
2761
|
}
|
|
2739
2762
|
|
|
2740
2763
|
/**
|
|
@@ -2882,21 +2905,21 @@ declare class StatePublicService<T extends IStateData = IStateData> implements T
|
|
|
2882
2905
|
* @param {StateName} stateName - The name of the state.
|
|
2883
2906
|
* @returns {Promise<T>} - The updated state.
|
|
2884
2907
|
*/
|
|
2885
|
-
setState: (dispatchFn: (prevState: T) => Promise<T>, clientId: string, stateName: StateName) => Promise<T>;
|
|
2908
|
+
setState: (dispatchFn: (prevState: T) => Promise<T>, requestId: string, clientId: string, stateName: StateName) => Promise<T>;
|
|
2886
2909
|
/**
|
|
2887
2910
|
* Gets the current state.
|
|
2888
2911
|
* @param {string} clientId - The client ID.
|
|
2889
2912
|
* @param {StateName} stateName - The name of the state.
|
|
2890
2913
|
* @returns {Promise<T>} - The current state.
|
|
2891
2914
|
*/
|
|
2892
|
-
getState: (clientId: string, stateName: StateName) => Promise<T>;
|
|
2915
|
+
getState: (requestId: string, clientId: string, stateName: StateName) => Promise<T>;
|
|
2893
2916
|
/**
|
|
2894
2917
|
* Disposes the state.
|
|
2895
2918
|
* @param {string} clientId - The client ID.
|
|
2896
2919
|
* @param {StateName} stateName - The name of the state.
|
|
2897
2920
|
* @returns {Promise<void>} - A promise that resolves when the state is disposed.
|
|
2898
2921
|
*/
|
|
2899
|
-
dispose: (clientId: string, stateName: StateName) => Promise<void>;
|
|
2922
|
+
dispose: (requestId: string, clientId: string, stateName: StateName) => Promise<void>;
|
|
2900
2923
|
}
|
|
2901
2924
|
|
|
2902
2925
|
/**
|
|
@@ -2931,7 +2954,7 @@ declare class BusService implements IBus {
|
|
|
2931
2954
|
* @param {EventSource} source - The event source.
|
|
2932
2955
|
* @param {(event: T) => void} fn - The callback function to handle the event.
|
|
2933
2956
|
*/
|
|
2934
|
-
subscribe: <T extends IBaseEvent>(clientId: string, source: EventSource, fn: (event: T) => void) => void;
|
|
2957
|
+
subscribe: <T extends IBaseEvent>(clientId: string, source: EventSource, fn: (event: T) => void) => () => void;
|
|
2935
2958
|
/**
|
|
2936
2959
|
* Subscribes to a single event for a specific client and source.
|
|
2937
2960
|
* @param {string} clientId - The client ID.
|
|
@@ -3170,7 +3193,7 @@ interface ISessionConfig {
|
|
|
3170
3193
|
* @param {SwarmName} swarmName - The name of the swarm.
|
|
3171
3194
|
* @returns {Promise<void>} A promise that resolves when the connection is disposed.
|
|
3172
3195
|
*/
|
|
3173
|
-
declare const disposeConnection: (clientId: string, swarmName: SwarmName) => Promise<void>;
|
|
3196
|
+
declare const disposeConnection: (clientId: string, swarmName: SwarmName, requestId?: string) => Promise<void>;
|
|
3174
3197
|
|
|
3175
3198
|
/**
|
|
3176
3199
|
* Retrieves the raw history as it is for a given client ID without any modifications.
|
|
@@ -3178,7 +3201,7 @@ declare const disposeConnection: (clientId: string, swarmName: SwarmName) => Pro
|
|
|
3178
3201
|
* @param {string} clientId - The ID of the client whose history is to be retrieved.
|
|
3179
3202
|
* @returns {Promise<Array>} A promise that resolves to an array containing the raw history.
|
|
3180
3203
|
*/
|
|
3181
|
-
declare const getRawHistory: (clientId: string) => Promise<IModelMessage[]>;
|
|
3204
|
+
declare const getRawHistory: (clientId: string, requestId?: string) => Promise<IModelMessage[]>;
|
|
3182
3205
|
|
|
3183
3206
|
/**
|
|
3184
3207
|
* Retrieves the history prepared for a specific agent with resque algorithm tweaks
|
|
@@ -3324,7 +3347,16 @@ declare const executeForce: (content: string, clientId: string) => Promise<strin
|
|
|
3324
3347
|
* @param {string} clientId - The ID of the client to listen for events from.
|
|
3325
3348
|
* @param {(data: T) => void} fn - The callback function to execute when the event is received. The data payload is passed as an argument to this function.
|
|
3326
3349
|
*/
|
|
3327
|
-
declare const listenEvent: <T extends unknown = any>(clientId: string, topicName: string, fn: (data: T) => void) => void;
|
|
3350
|
+
declare const listenEvent: <T extends unknown = any>(clientId: string, topicName: string, fn: (data: T) => void) => () => void;
|
|
3351
|
+
|
|
3352
|
+
/**
|
|
3353
|
+
* Listens for an event on the swarm bus service and executes a callback function when the event is received.
|
|
3354
|
+
*
|
|
3355
|
+
* @template T - The type of the data payload.
|
|
3356
|
+
* @param {string} clientId - The ID of the client to listen for events from.
|
|
3357
|
+
* @param {(data: T) => void} fn - The callback function to execute when the event is received. The data payload is passed as an argument to this function.
|
|
3358
|
+
*/
|
|
3359
|
+
declare const listenEventOnce: <T extends unknown = any>(clientId: string, topicName: string, filterFn: (event: T) => boolean, fn: (data: T) => void) => () => void;
|
|
3328
3360
|
|
|
3329
3361
|
/**
|
|
3330
3362
|
* Retrieves the last message sent by the user from the client's message history.
|
|
@@ -3441,7 +3473,7 @@ declare const cancelOutputForce: (clientId: string) => Promise<void>;
|
|
|
3441
3473
|
* @param {string} clientId - The ID of the client to subscribe to events for.
|
|
3442
3474
|
* @param {function} fn - The callback function to handle the event.
|
|
3443
3475
|
*/
|
|
3444
|
-
declare const listenAgentEvent: (clientId: string, fn: (event: IBusEvent) => void) => void;
|
|
3476
|
+
declare const listenAgentEvent: (clientId: string, fn: (event: IBusEvent) => void) => () => void;
|
|
3445
3477
|
|
|
3446
3478
|
/**
|
|
3447
3479
|
* Hook to subscribe to history events for a specific client.
|
|
@@ -3449,7 +3481,7 @@ declare const listenAgentEvent: (clientId: string, fn: (event: IBusEvent) => voi
|
|
|
3449
3481
|
* @param {string} clientId - The ID of the client to subscribe to.
|
|
3450
3482
|
* @param {(event: IBusEvent) => void} fn - The callback function to handle the event.
|
|
3451
3483
|
*/
|
|
3452
|
-
declare const listenHistoryEvent: (clientId: string, fn: (event: IBusEvent) => void) => void;
|
|
3484
|
+
declare const listenHistoryEvent: (clientId: string, fn: (event: IBusEvent) => void) => () => void;
|
|
3453
3485
|
|
|
3454
3486
|
/**
|
|
3455
3487
|
* Hook to subscribe to session events for a specific client.
|
|
@@ -3457,7 +3489,7 @@ declare const listenHistoryEvent: (clientId: string, fn: (event: IBusEvent) => v
|
|
|
3457
3489
|
* @param {string} clientId - The ID of the client to subscribe to session events for.
|
|
3458
3490
|
* @param {function} fn - The callback function to handle the session events.
|
|
3459
3491
|
*/
|
|
3460
|
-
declare const listenSessionEvent: (clientId: string, fn: (event: IBusEvent) => void) => void;
|
|
3492
|
+
declare const listenSessionEvent: (clientId: string, fn: (event: IBusEvent) => void) => () => void;
|
|
3461
3493
|
|
|
3462
3494
|
/**
|
|
3463
3495
|
* Hook to subscribe to state events for a specific client.
|
|
@@ -3465,7 +3497,7 @@ declare const listenSessionEvent: (clientId: string, fn: (event: IBusEvent) => v
|
|
|
3465
3497
|
* @param {string} clientId - The ID of the client to subscribe to.
|
|
3466
3498
|
* @param {function} fn - The callback function to handle the event.
|
|
3467
3499
|
*/
|
|
3468
|
-
declare const listenStateEvent: (clientId: string, fn: (event: IBusEvent) => void) => void;
|
|
3500
|
+
declare const listenStateEvent: (clientId: string, fn: (event: IBusEvent) => void) => () => void;
|
|
3469
3501
|
|
|
3470
3502
|
/**
|
|
3471
3503
|
* Hook to subscribe to storage events for a specific client.
|
|
@@ -3473,7 +3505,7 @@ declare const listenStateEvent: (clientId: string, fn: (event: IBusEvent) => voi
|
|
|
3473
3505
|
* @param {string} clientId - The ID of the client to subscribe to storage events for.
|
|
3474
3506
|
* @param {function} fn - The callback function to handle the storage event.
|
|
3475
3507
|
*/
|
|
3476
|
-
declare const listenStorageEvent: (clientId: string, fn: (event: IBusEvent) => void) => void;
|
|
3508
|
+
declare const listenStorageEvent: (clientId: string, fn: (event: IBusEvent) => void) => () => void;
|
|
3477
3509
|
|
|
3478
3510
|
/**
|
|
3479
3511
|
* Hook to subscribe to swarm events for a specific client.
|
|
@@ -3481,7 +3513,55 @@ declare const listenStorageEvent: (clientId: string, fn: (event: IBusEvent) => v
|
|
|
3481
3513
|
* @param {string} clientId - The ID of the client to subscribe to events for.
|
|
3482
3514
|
* @param {(event: IBusEvent) => void} fn - The callback function to handle the event.
|
|
3483
3515
|
*/
|
|
3484
|
-
declare const listenSwarmEvent: (clientId: string, fn: (event: IBusEvent) => void) => void;
|
|
3516
|
+
declare const listenSwarmEvent: (clientId: string, fn: (event: IBusEvent) => void) => () => void;
|
|
3517
|
+
|
|
3518
|
+
/**
|
|
3519
|
+
* Hook to subscribe to agent events for a specific client.
|
|
3520
|
+
*
|
|
3521
|
+
* @param {string} clientId - The ID of the client to subscribe to events for.
|
|
3522
|
+
* @param {function} fn - The callback function to handle the event.
|
|
3523
|
+
*/
|
|
3524
|
+
declare const listenAgentEventOnce: (clientId: string, filterFn: (event: IBusEvent) => boolean, fn: (event: IBusEvent) => void) => () => void;
|
|
3525
|
+
|
|
3526
|
+
/**
|
|
3527
|
+
* Hook to subscribe to history events for a specific client.
|
|
3528
|
+
*
|
|
3529
|
+
* @param {string} clientId - The ID of the client to subscribe to.
|
|
3530
|
+
* @param {(event: IBusEvent) => void} fn - The callback function to handle the event.
|
|
3531
|
+
*/
|
|
3532
|
+
declare const listenHistoryEventOnce: (clientId: string, filterFn: (event: IBusEvent) => boolean, fn: (event: IBusEvent) => void) => () => void;
|
|
3533
|
+
|
|
3534
|
+
/**
|
|
3535
|
+
* Hook to subscribe to session events for a specific client.
|
|
3536
|
+
*
|
|
3537
|
+
* @param {string} clientId - The ID of the client to subscribe to session events for.
|
|
3538
|
+
* @param {function} fn - The callback function to handle the session events.
|
|
3539
|
+
*/
|
|
3540
|
+
declare const listenSessionEventOnce: (clientId: string, filterFn: (event: IBusEvent) => boolean, fn: (event: IBusEvent) => void) => () => void;
|
|
3541
|
+
|
|
3542
|
+
/**
|
|
3543
|
+
* Hook to subscribe to state events for a specific client.
|
|
3544
|
+
*
|
|
3545
|
+
* @param {string} clientId - The ID of the client to subscribe to.
|
|
3546
|
+
* @param {function} fn - The callback function to handle the event.
|
|
3547
|
+
*/
|
|
3548
|
+
declare const listenStateEventOnce: (clientId: string, filterFn: (event: IBusEvent) => boolean, fn: (event: IBusEvent) => void) => () => void;
|
|
3549
|
+
|
|
3550
|
+
/**
|
|
3551
|
+
* Hook to subscribe to storage events for a specific client.
|
|
3552
|
+
*
|
|
3553
|
+
* @param {string} clientId - The ID of the client to subscribe to storage events for.
|
|
3554
|
+
* @param {function} fn - The callback function to handle the storage event.
|
|
3555
|
+
*/
|
|
3556
|
+
declare const listenStorageEventOnce: (clientId: string, filterFn: (event: IBusEvent) => boolean, fn: (event: IBusEvent) => void) => () => void;
|
|
3557
|
+
|
|
3558
|
+
/**
|
|
3559
|
+
* Hook to subscribe to swarm events for a specific client.
|
|
3560
|
+
*
|
|
3561
|
+
* @param {string} clientId - The ID of the client to subscribe to events for.
|
|
3562
|
+
* @param {(event: IBusEvent) => void} fn - The callback function to handle the event.
|
|
3563
|
+
*/
|
|
3564
|
+
declare const listenSwarmEventOnce: (clientId: string, filterFn: (event: IBusEvent) => boolean, fn: (event: IBusEvent) => void) => () => void;
|
|
3485
3565
|
|
|
3486
3566
|
declare const GLOBAL_CONFIG: {
|
|
3487
3567
|
CC_TOOL_CALL_EXCEPTION_PROMPT: string;
|
|
@@ -3644,4 +3724,17 @@ declare class StateUtils implements TState {
|
|
|
3644
3724
|
*/
|
|
3645
3725
|
declare const State: StateUtils;
|
|
3646
3726
|
|
|
3647
|
-
|
|
3727
|
+
declare class LoggerUtils {
|
|
3728
|
+
/**
|
|
3729
|
+
* Sets the provided logger to the logger service.
|
|
3730
|
+
* @param {ILogger} logger - The logger instance to be used.
|
|
3731
|
+
*/
|
|
3732
|
+
useLogger: (logger: ILogger) => void;
|
|
3733
|
+
}
|
|
3734
|
+
/**
|
|
3735
|
+
* Instance of LoggerUtils to be used for logging.
|
|
3736
|
+
* @type {LoggerUtils}
|
|
3737
|
+
*/
|
|
3738
|
+
declare const Logger: LoggerUtils;
|
|
3739
|
+
|
|
3740
|
+
export { ContextService, type EventSource, History, HistoryAdapter, HistoryInstance, type IAgentSchema, type IAgentTool, type IBaseEvent, type IBusEvent, type IBusEventContext, type ICompletionArgs, type ICompletionSchema, type ICustomEvent, type IEmbeddingSchema, type IHistoryAdapter, type IHistoryInstance, type IHistoryInstanceCallbacks, type IIncomingMessage, type IMakeConnectionConfig, type IMakeDisposeParams, type IModelMessage, type IOutgoingMessage, type ISessionConfig, type IStateSchema, type IStorageSchema, type ISwarmSchema, type ITool, type IToolCall, Logger, type ReceiveMessageFn, type SendMessageFn$1 as SendMessageFn, State, Storage, addAgent, addCompletion, addEmbedding, addState, addStorage, addSwarm, addTool, cancelOutput, cancelOutputForce, changeAgent, commitFlush, commitFlushForce, commitSystemMessage, commitSystemMessageForce, commitToolOutput, commitToolOutputForce, commitUserMessage, commitUserMessageForce, complete, disposeConnection, emit, emitForce, event, execute, executeForce, getAgentHistory, getAgentName, getAssistantHistory, getLastAssistantMessage, getLastSystemMessage, getLastUserMessage, getRawHistory, getSessionMode, getUserHistory, listenAgentEvent, listenAgentEventOnce, listenEvent, listenEventOnce, listenHistoryEvent, listenHistoryEventOnce, listenSessionEvent, listenSessionEventOnce, listenStateEvent, listenStateEventOnce, listenStorageEvent, listenStorageEventOnce, listenSwarmEvent, listenSwarmEventOnce, makeAutoDispose, makeConnection, session, setConfig, swarm };
|