agent-swarm-kit 1.0.111 → 1.0.113
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 +579 -127
- package/build/index.mjs +578 -128
- package/package.json +1 -1
- package/types.d.ts +131 -1
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -408,6 +408,11 @@ interface IState<T extends IStateData = IStateData> {
|
|
|
408
408
|
* @returns {Promise<T>} - The updated state.
|
|
409
409
|
*/
|
|
410
410
|
setState: (dispatchFn: (prevState: T) => Promise<T>) => Promise<T>;
|
|
411
|
+
/**
|
|
412
|
+
* Set the state to initial value
|
|
413
|
+
* @returns {Promise<T>} - The initial state.
|
|
414
|
+
*/
|
|
415
|
+
clearState: () => Promise<T>;
|
|
411
416
|
}
|
|
412
417
|
/**
|
|
413
418
|
* The name of the state.
|
|
@@ -712,6 +717,11 @@ interface ISession {
|
|
|
712
717
|
* @returns {Promise<void>}
|
|
713
718
|
*/
|
|
714
719
|
commitFlush: () => Promise<void>;
|
|
720
|
+
/**
|
|
721
|
+
* Prevent the next tool from being executed
|
|
722
|
+
* @returns {Promise<void>}
|
|
723
|
+
*/
|
|
724
|
+
commitStopTools: () => Promise<void>;
|
|
715
725
|
/**
|
|
716
726
|
* Commit a system message.
|
|
717
727
|
* @param {string} message - The message to commit.
|
|
@@ -1487,11 +1497,21 @@ interface IAgent {
|
|
|
1487
1497
|
* @returns A promise that resolves when the flush is committed.
|
|
1488
1498
|
*/
|
|
1489
1499
|
commitFlush(): Promise<void>;
|
|
1500
|
+
/**
|
|
1501
|
+
* Prevent the next tool from being executed
|
|
1502
|
+
* @returns A promise that resolves when the tool stop is committed.
|
|
1503
|
+
*/
|
|
1504
|
+
commitStopTools(): Promise<void>;
|
|
1490
1505
|
/**
|
|
1491
1506
|
* Unlock the queue on agent change. Stop the next tool execution
|
|
1492
1507
|
* @returns A promise that resolves when the agent change is committed.
|
|
1493
1508
|
*/
|
|
1494
1509
|
commitAgentChange(): Promise<void>;
|
|
1510
|
+
/**
|
|
1511
|
+
* Prevent the next tool from execution
|
|
1512
|
+
* @returns A promise that resolves when the tool stop is committed.
|
|
1513
|
+
*/
|
|
1514
|
+
commitStopTools(): Promise<void>;
|
|
1495
1515
|
}
|
|
1496
1516
|
/** Type representing the name of an agent. */
|
|
1497
1517
|
type AgentName = string;
|
|
@@ -1556,6 +1576,7 @@ declare class LoggerService implements ILogger {
|
|
|
1556
1576
|
|
|
1557
1577
|
declare const AGENT_CHANGE_SYMBOL: unique symbol;
|
|
1558
1578
|
declare const TOOL_ERROR_SYMBOL: unique symbol;
|
|
1579
|
+
declare const TOOL_STOP_SYMBOL: unique symbol;
|
|
1559
1580
|
/**
|
|
1560
1581
|
* Represents a client agent that interacts with the system.
|
|
1561
1582
|
* @implements {IAgent}
|
|
@@ -1564,6 +1585,7 @@ declare class ClientAgent implements IAgent {
|
|
|
1564
1585
|
readonly params: IAgentParams;
|
|
1565
1586
|
readonly _agentChangeSubject: Subject<typeof AGENT_CHANGE_SYMBOL>;
|
|
1566
1587
|
readonly _toolErrorSubject: Subject<typeof TOOL_ERROR_SYMBOL>;
|
|
1588
|
+
readonly _toolStopSubject: Subject<typeof TOOL_STOP_SYMBOL>;
|
|
1567
1589
|
readonly _toolCommitSubject: Subject<void>;
|
|
1568
1590
|
readonly _outputSubject: Subject<string>;
|
|
1569
1591
|
/**
|
|
@@ -1611,6 +1633,11 @@ declare class ClientAgent implements IAgent {
|
|
|
1611
1633
|
* @returns {Promise<void>}
|
|
1612
1634
|
*/
|
|
1613
1635
|
commitAgentChange: () => Promise<void>;
|
|
1636
|
+
/**
|
|
1637
|
+
* Commits change of agent to prevent the next tool execution from being called.
|
|
1638
|
+
* @returns {Promise<void>}
|
|
1639
|
+
*/
|
|
1640
|
+
commitStopTools: () => Promise<void>;
|
|
1614
1641
|
/**
|
|
1615
1642
|
* Commits a system message to the history.
|
|
1616
1643
|
* @param {string} message - The system message to commit.
|
|
@@ -1704,6 +1731,11 @@ declare class AgentConnectionService implements IAgent {
|
|
|
1704
1731
|
* @returns {Promise<any>} The commit result.
|
|
1705
1732
|
*/
|
|
1706
1733
|
commitAgentChange: () => Promise<void>;
|
|
1734
|
+
/**
|
|
1735
|
+
* Prevent the next tool from being executed
|
|
1736
|
+
* @returns {Promise<any>} The commit result.
|
|
1737
|
+
*/
|
|
1738
|
+
commitStopTools: () => Promise<void>;
|
|
1707
1739
|
/**
|
|
1708
1740
|
* Commits flush of agent history
|
|
1709
1741
|
* @returns {Promise<any>} The commit result.
|
|
@@ -2050,6 +2082,11 @@ declare class ClientSession implements ISession {
|
|
|
2050
2082
|
* @returns {Promise<void>}
|
|
2051
2083
|
*/
|
|
2052
2084
|
commitFlush: () => Promise<void>;
|
|
2085
|
+
/**
|
|
2086
|
+
* Commits stop of the nexttool execution
|
|
2087
|
+
* @returns {Promise<void>}
|
|
2088
|
+
*/
|
|
2089
|
+
commitStopTools: () => Promise<void>;
|
|
2053
2090
|
/**
|
|
2054
2091
|
* Commits a system message.
|
|
2055
2092
|
* @param {string} message - The system message to commit.
|
|
@@ -2141,6 +2178,12 @@ declare class SessionConnectionService implements ISession {
|
|
|
2141
2178
|
* @returns {Promise<void>} A promise that resolves when the message is committed.
|
|
2142
2179
|
*/
|
|
2143
2180
|
commitFlush: () => Promise<void>;
|
|
2181
|
+
/**
|
|
2182
|
+
* Commits user message to the agent without answer.
|
|
2183
|
+
* @param {string} message - The message to commit.
|
|
2184
|
+
* @returns {Promise<void>} A promise that resolves when the message is committed.
|
|
2185
|
+
*/
|
|
2186
|
+
commitStopTools: () => Promise<void>;
|
|
2144
2187
|
/**
|
|
2145
2188
|
* Disposes of the session connection service.
|
|
2146
2189
|
* @returns {Promise<void>} A promise that resolves when the service is disposed.
|
|
@@ -2231,6 +2274,13 @@ declare class AgentPublicService implements TAgentConnectionService {
|
|
|
2231
2274
|
* @returns {Promise<unknown>} The commit result.
|
|
2232
2275
|
*/
|
|
2233
2276
|
commitAgentChange: (methodName: string, clientId: string, agentName: AgentName) => Promise<void>;
|
|
2277
|
+
/**
|
|
2278
|
+
* Prevent the next tool from being executed
|
|
2279
|
+
* @param {string} clientId - The client ID.
|
|
2280
|
+
* @param {AgentName} agentName - The name of the agent.
|
|
2281
|
+
* @returns {Promise<unknown>} The commit result.
|
|
2282
|
+
*/
|
|
2283
|
+
commitStopTools: (methodName: string, clientId: string, agentName: AgentName) => Promise<void>;
|
|
2234
2284
|
/**
|
|
2235
2285
|
* Disposes of the agent.
|
|
2236
2286
|
* @param {string} clientId - The client ID.
|
|
@@ -2365,6 +2415,13 @@ declare class SessionPublicService implements TSessionConnectionService {
|
|
|
2365
2415
|
* @returns {Promise<void>}
|
|
2366
2416
|
*/
|
|
2367
2417
|
commitFlush: (methodName: string, clientId: string, swarmName: SwarmName) => Promise<void>;
|
|
2418
|
+
/**
|
|
2419
|
+
* Prevent the next tool from being executed
|
|
2420
|
+
* @param {string} clientId - The client ID.
|
|
2421
|
+
* @param {SwarmName} swarmName - The swarm name.
|
|
2422
|
+
* @returns {Promise<void>}
|
|
2423
|
+
*/
|
|
2424
|
+
commitStopTools: (methodName: string, clientId: string, swarmName: SwarmName) => Promise<void>;
|
|
2368
2425
|
/**
|
|
2369
2426
|
* Disposes of the session.
|
|
2370
2427
|
* @param {string} clientId - The client ID.
|
|
@@ -3013,6 +3070,11 @@ declare class ClientState<State extends IStateData = IStateData> implements ISta
|
|
|
3013
3070
|
* @returns {Promise<State>}
|
|
3014
3071
|
*/
|
|
3015
3072
|
setState: (dispatchFn: DispatchFn<State>) => Promise<State>;
|
|
3073
|
+
/**
|
|
3074
|
+
* Sets the to initial value
|
|
3075
|
+
* @returns {Promise<State>}
|
|
3076
|
+
*/
|
|
3077
|
+
clearState: () => Promise<State>;
|
|
3016
3078
|
/**
|
|
3017
3079
|
* Gets the current state.
|
|
3018
3080
|
* @returns {Promise<State>}
|
|
@@ -3051,6 +3113,11 @@ declare class StateConnectionService<T extends IStateData = IStateData> implemen
|
|
|
3051
3113
|
* @returns {Promise<T>} The new state.
|
|
3052
3114
|
*/
|
|
3053
3115
|
setState: (dispatchFn: (prevState: T) => Promise<T>) => Promise<T>;
|
|
3116
|
+
/**
|
|
3117
|
+
* Set the state to initial value
|
|
3118
|
+
* @returns {Promise<T>} The initial state.
|
|
3119
|
+
*/
|
|
3120
|
+
clearState: () => Promise<T>;
|
|
3054
3121
|
/**
|
|
3055
3122
|
* Gets the state.
|
|
3056
3123
|
* @returns {Promise<T>} The current state.
|
|
@@ -3083,6 +3150,13 @@ declare class StatePublicService<T extends IStateData = IStateData> implements T
|
|
|
3083
3150
|
* @returns {Promise<T>} - The updated state.
|
|
3084
3151
|
*/
|
|
3085
3152
|
setState: (dispatchFn: (prevState: T) => Promise<T>, methodName: string, clientId: string, stateName: StateName) => Promise<T>;
|
|
3153
|
+
/**
|
|
3154
|
+
* Set the state to initial value
|
|
3155
|
+
* @param {string} clientId - The client ID.
|
|
3156
|
+
* @param {StateName} stateName - The name of the state.
|
|
3157
|
+
* @returns {Promise<T>} - The initial state.
|
|
3158
|
+
*/
|
|
3159
|
+
clearState: (methodName: string, clientId: string, stateName: StateName) => Promise<T>;
|
|
3086
3160
|
/**
|
|
3087
3161
|
* Gets the current state.
|
|
3088
3162
|
* @param {string} clientId - The client ID.
|
|
@@ -3330,6 +3404,11 @@ declare class SharedStateConnectionService<T extends IStateData = IStateData> im
|
|
|
3330
3404
|
* @returns {Promise<T>} The new state.
|
|
3331
3405
|
*/
|
|
3332
3406
|
setState: (dispatchFn: (prevState: T) => Promise<T>) => Promise<T>;
|
|
3407
|
+
/**
|
|
3408
|
+
* Set the state to initial value
|
|
3409
|
+
* @returns {Promise<T>} The new state.
|
|
3410
|
+
*/
|
|
3411
|
+
clearState: () => Promise<T>;
|
|
3333
3412
|
/**
|
|
3334
3413
|
* Gets the state.
|
|
3335
3414
|
* @returns {Promise<T>} The current state.
|
|
@@ -3356,6 +3435,12 @@ declare class SharedStatePublicService<T extends IStateData = IStateData> implem
|
|
|
3356
3435
|
* @returns {Promise<T>} - The updated state.
|
|
3357
3436
|
*/
|
|
3358
3437
|
setState: (dispatchFn: (prevState: T) => Promise<T>, methodName: string, stateName: StateName) => Promise<T>;
|
|
3438
|
+
/**
|
|
3439
|
+
* Set the state to initial value
|
|
3440
|
+
* @param {StateName} stateName - The name of the state.
|
|
3441
|
+
* @returns {Promise<T>} - The initial state.
|
|
3442
|
+
*/
|
|
3443
|
+
clearState: (methodName: string, stateName: StateName) => Promise<T>;
|
|
3359
3444
|
/**
|
|
3360
3445
|
* Gets the current state.
|
|
3361
3446
|
* @param {StateName} stateName - The name of the state.
|
|
@@ -3661,6 +3746,23 @@ declare const cancelOutput: (clientId: string, agentName: string) => Promise<voi
|
|
|
3661
3746
|
*/
|
|
3662
3747
|
declare const cancelOutputForce: (clientId: string) => Promise<void>;
|
|
3663
3748
|
|
|
3749
|
+
/**
|
|
3750
|
+
* Prevent the next tool from being executed
|
|
3751
|
+
*
|
|
3752
|
+
* @param {string} clientId - The ID of the client.
|
|
3753
|
+
* @param {string} agentName - The name of the agent.
|
|
3754
|
+
* @returns {Promise<void>} - A promise that resolves when the message is committed.
|
|
3755
|
+
*/
|
|
3756
|
+
declare const commitStopTools: (clientId: string, agentName: string) => Promise<void>;
|
|
3757
|
+
|
|
3758
|
+
/**
|
|
3759
|
+
* Prevent the next tool from being executed without active agent check
|
|
3760
|
+
*
|
|
3761
|
+
* @param {string} clientId - The ID of the client.
|
|
3762
|
+
* @returns {Promise<void>} - A promise that resolves when the message is committed.
|
|
3763
|
+
*/
|
|
3764
|
+
declare const commitStopToolsForce: (clientId: string) => Promise<void>;
|
|
3765
|
+
|
|
3664
3766
|
/**
|
|
3665
3767
|
* Emits a string constant as the model output without executing incoming message and checking active agent
|
|
3666
3768
|
* Works only for `makeConnection`
|
|
@@ -4334,6 +4436,21 @@ declare class StateUtils implements TState {
|
|
|
4334
4436
|
agentName: AgentName;
|
|
4335
4437
|
stateName: StateName;
|
|
4336
4438
|
}) => Promise<void>;
|
|
4439
|
+
/**
|
|
4440
|
+
* Set the state to initial value
|
|
4441
|
+
* @template T
|
|
4442
|
+
* @param {Object} payload - The payload containing client and state information.
|
|
4443
|
+
* @param {string} payload.clientId - The client ID.
|
|
4444
|
+
* @param {AgentName} payload.agentName - The agent name.
|
|
4445
|
+
* @param {StateName} payload.stateName - The state name.
|
|
4446
|
+
* @returns {Promise<void>}
|
|
4447
|
+
* @throws Will throw an error if the state is not registered in the agent.
|
|
4448
|
+
*/
|
|
4449
|
+
clearState: <T extends unknown = any>(payload: {
|
|
4450
|
+
clientId: string;
|
|
4451
|
+
agentName: AgentName;
|
|
4452
|
+
stateName: StateName;
|
|
4453
|
+
}) => Promise<T>;
|
|
4337
4454
|
}
|
|
4338
4455
|
/**
|
|
4339
4456
|
* Instance of StateUtils for managing state.
|
|
@@ -4376,6 +4493,19 @@ declare class SharedStateUtils implements TSharedState {
|
|
|
4376
4493
|
agentName: AgentName;
|
|
4377
4494
|
stateName: StateName;
|
|
4378
4495
|
}) => Promise<void>;
|
|
4496
|
+
/**
|
|
4497
|
+
* Set the state to initial value
|
|
4498
|
+
* @template T
|
|
4499
|
+
* @param {Object} payload - The payload containing client and state information.
|
|
4500
|
+
* @param {AgentName} payload.agentName - The agent name.
|
|
4501
|
+
* @param {StateName} payload.stateName - The state name.
|
|
4502
|
+
* @returns {Promise<void>}
|
|
4503
|
+
* @throws Will throw an error if the state is not registered in the agent.
|
|
4504
|
+
*/
|
|
4505
|
+
clearState: <T extends unknown = any>(payload: {
|
|
4506
|
+
agentName: AgentName;
|
|
4507
|
+
stateName: StateName;
|
|
4508
|
+
}) => Promise<T>;
|
|
4379
4509
|
}
|
|
4380
4510
|
/**
|
|
4381
4511
|
* Instance of SharedStateUtils for managing state.
|
|
@@ -4581,4 +4711,4 @@ declare class SchemaUtils {
|
|
|
4581
4711
|
*/
|
|
4582
4712
|
declare const Schema: SchemaUtils;
|
|
4583
4713
|
|
|
4584
|
-
export { type EventSource, ExecutionContextService, 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 ILoggerAdapter, type ILoggerInstance, type ILoggerInstanceCallbacks, type IMakeConnectionConfig, type IMakeDisposeParams, type IModelMessage, type IOutgoingMessage, type ISessionConfig, type IStateSchema, type IStorageSchema, type ISwarmSchema, type ITool, type IToolCall, Logger, LoggerAdapter, LoggerInstance, MethodContextService, type ReceiveMessageFn, Schema, type SendMessageFn$1 as SendMessageFn, SharedState, SharedStorage, State, Storage, addAgent, addCompletion, addEmbedding, addState, addStorage, addSwarm, addTool, cancelOutput, cancelOutputForce, changeToAgent, changeToDefaultAgent, changeToPrevAgent, commitAssistantMessage, commitAssistantMessageForce, commitFlush, commitFlushForce, commitSystemMessage, commitSystemMessageForce, commitToolOutput, commitToolOutputForce, commitUserMessage, commitUserMessageForce, complete, disposeConnection, dumpAgent, dumpDocs, dumpSwarm, 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 };
|
|
4714
|
+
export { type EventSource, ExecutionContextService, 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 ILoggerAdapter, type ILoggerInstance, type ILoggerInstanceCallbacks, type IMakeConnectionConfig, type IMakeDisposeParams, type IModelMessage, type IOutgoingMessage, type ISessionConfig, type IStateSchema, type IStorageSchema, type ISwarmSchema, type ITool, type IToolCall, Logger, LoggerAdapter, LoggerInstance, MethodContextService, type ReceiveMessageFn, Schema, type SendMessageFn$1 as SendMessageFn, SharedState, SharedStorage, State, Storage, addAgent, addCompletion, addEmbedding, addState, addStorage, addSwarm, addTool, cancelOutput, cancelOutputForce, changeToAgent, changeToDefaultAgent, changeToPrevAgent, commitAssistantMessage, commitAssistantMessageForce, commitFlush, commitFlushForce, commitStopTools, commitStopToolsForce, commitSystemMessage, commitSystemMessageForce, commitToolOutput, commitToolOutputForce, commitUserMessage, commitUserMessageForce, complete, disposeConnection, dumpAgent, dumpDocs, dumpSwarm, 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 };
|