agent-swarm-kit 1.1.39 → 1.1.40
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 +1 -1
- package/build/index.cjs +4 -4
- package/build/index.mjs +4 -4
- package/package.json +1 -1
- package/types.d.ts +3 -3
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ Unleash the power of collaborative AI with `agent-swarm-kit`! This library empow
|
|
|
27
27
|
|
|
28
28
|
- **Redis Storage Integration**: Persists state management, RAG (Retrieval-Augmented Generation) search data, and chat history in Redis, ensuring reliable, scalable, and high-performance storage. This enables safe and consistent access to agent states, vector search results, and conversation histories across distributed systems (Microservices).
|
|
29
29
|
|
|
30
|
-
- **Chat Independent Background Agent Sessions**: Enables the swarm to perform complex data processing computations in isolated contexts, such as financial analytics, allowing agents to handle intensive tasks like market trend analysis or portfolio optimization without interfering with the primary chat flow.
|
|
30
|
+
- **Chat Independent Background Agent Sessions**: Enables the swarm to perform complex data processing computations in isolated contexts, such as financial analytics, allowing agents to handle intensive tasks like market trend analysis or portfolio optimization without interfering with the primary chat flow. Works the same way like [fork in POSIX](https://pubs.opengroup.org/onlinepubs/009696799/functions/fork.html)
|
|
31
31
|
|
|
32
32
|
---
|
|
33
33
|
|
package/build/index.cjs
CHANGED
|
@@ -20014,9 +20014,9 @@ session.rate = (clientId, swarmName, { delay = SCHEDULED_DELAY, onDispose } = {}
|
|
|
20014
20014
|
* @description Method name for the scope operation.
|
|
20015
20015
|
* @private
|
|
20016
20016
|
*/
|
|
20017
|
-
const METHOD_NAME$e = "function.target.
|
|
20017
|
+
const METHOD_NAME$e = "function.target.fork";
|
|
20018
20018
|
/**
|
|
20019
|
-
* @function
|
|
20019
|
+
* @function fork
|
|
20020
20020
|
* @description Executes a provided function within a managed scope, handling session creation, validation, and cleanup.
|
|
20021
20021
|
* @template T - Type of the result returned by the run function.
|
|
20022
20022
|
* @param {Function} runFn - The function to execute, receiving clientId and agentName as arguments.
|
|
@@ -20024,7 +20024,7 @@ const METHOD_NAME$e = "function.target.scope";
|
|
|
20024
20024
|
* @returns {Promise<T | void>} The result of the run function or void if no result is returned.
|
|
20025
20025
|
* @throws {Error} If a session already exists for the clientId.
|
|
20026
20026
|
*/
|
|
20027
|
-
const
|
|
20027
|
+
const fork = beginContext(async (runFn, { clientId, swarmName, onError }) => {
|
|
20028
20028
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
20029
20029
|
swarm$1.loggerService.log(METHOD_NAME$e, {
|
|
20030
20030
|
clientId,
|
|
@@ -22833,6 +22833,7 @@ exports.emitForce = emitForce;
|
|
|
22833
22833
|
exports.event = event;
|
|
22834
22834
|
exports.execute = execute;
|
|
22835
22835
|
exports.executeForce = executeForce;
|
|
22836
|
+
exports.fork = fork;
|
|
22836
22837
|
exports.getAgentHistory = getAgentHistory;
|
|
22837
22838
|
exports.getAgentName = getAgentName;
|
|
22838
22839
|
exports.getAssistantHistory = getAssistantHistory;
|
|
@@ -22887,7 +22888,6 @@ exports.question = question;
|
|
|
22887
22888
|
exports.questionForce = questionForce;
|
|
22888
22889
|
exports.runStateless = runStateless;
|
|
22889
22890
|
exports.runStatelessForce = runStatelessForce;
|
|
22890
|
-
exports.scope = scope;
|
|
22891
22891
|
exports.session = session;
|
|
22892
22892
|
exports.setConfig = setConfig;
|
|
22893
22893
|
exports.startPipeline = startPipeline;
|
package/build/index.mjs
CHANGED
|
@@ -20012,9 +20012,9 @@ session.rate = (clientId, swarmName, { delay = SCHEDULED_DELAY, onDispose } = {}
|
|
|
20012
20012
|
* @description Method name for the scope operation.
|
|
20013
20013
|
* @private
|
|
20014
20014
|
*/
|
|
20015
|
-
const METHOD_NAME$e = "function.target.
|
|
20015
|
+
const METHOD_NAME$e = "function.target.fork";
|
|
20016
20016
|
/**
|
|
20017
|
-
* @function
|
|
20017
|
+
* @function fork
|
|
20018
20018
|
* @description Executes a provided function within a managed scope, handling session creation, validation, and cleanup.
|
|
20019
20019
|
* @template T - Type of the result returned by the run function.
|
|
20020
20020
|
* @param {Function} runFn - The function to execute, receiving clientId and agentName as arguments.
|
|
@@ -20022,7 +20022,7 @@ const METHOD_NAME$e = "function.target.scope";
|
|
|
20022
20022
|
* @returns {Promise<T | void>} The result of the run function or void if no result is returned.
|
|
20023
20023
|
* @throws {Error} If a session already exists for the clientId.
|
|
20024
20024
|
*/
|
|
20025
|
-
const
|
|
20025
|
+
const fork = beginContext(async (runFn, { clientId, swarmName, onError }) => {
|
|
20026
20026
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
20027
20027
|
swarm$1.loggerService.log(METHOD_NAME$e, {
|
|
20028
20028
|
clientId,
|
|
@@ -22753,4 +22753,4 @@ const Utils = {
|
|
|
22753
22753
|
PersistEmbeddingUtils,
|
|
22754
22754
|
};
|
|
22755
22755
|
|
|
22756
|
-
export { Adapter, Chat, Compute, ExecutionContextService, History, HistoryMemoryInstance, HistoryPersistInstance, Logger, LoggerInstance, MCP, MethodContextService, Operator, OperatorInstance, PayloadContextService, PersistAlive, PersistBase, PersistEmbedding, PersistList, PersistMemory, PersistPolicy, PersistState, PersistStorage, PersistSwarm, Policy, RoundRobin, Schema, SharedCompute, SharedState, SharedStorage, State, Storage, Utils, addAgent, addAgentNavigation, addCompletion, addCompute, addEmbedding, addMCP, addPipeline, addPolicy, addState, addStorage, addSwarm, addTool, addTriageNavigation, addWiki, beginContext, cancelOutput, cancelOutputForce, changeToAgent, changeToDefaultAgent, changeToPrevAgent, commitAssistantMessage, commitAssistantMessageForce, commitFlush, commitFlushForce, commitStopTools, commitStopToolsForce, commitSystemMessage, commitSystemMessageForce, commitToolOutput, commitToolOutputForce, commitUserMessage, commitUserMessageForce, complete, createNavigateToAgent, createNavigateToTriageAgent, disposeConnection, dumpAgent, dumpClientPerformance, dumpDocs, dumpPerfomance, dumpSwarm, emit, emitForce, event, execute, executeForce, getAgentHistory, getAgentName, getAssistantHistory, getLastAssistantMessage, getLastSystemMessage, getLastUserMessage, getNavigationRoute, getPayload, getRawHistory, getSessionContext, getSessionMode, getUserHistory, hasNavigation, hasSession, listenAgentEvent, listenAgentEventOnce, listenEvent, listenEventOnce, listenExecutionEvent, listenExecutionEventOnce, listenHistoryEvent, listenHistoryEventOnce, listenPolicyEvent, listenPolicyEventOnce, listenSessionEvent, listenSessionEventOnce, listenStateEvent, listenStateEventOnce, listenStorageEvent, listenStorageEventOnce, listenSwarmEvent, listenSwarmEventOnce, makeAutoDispose, makeConnection, markOffline, markOnline, notify, notifyForce, overrideAgent, overrideCompletion, overrideCompute, overrideEmbeding, overrideMCP, overridePipeline, overridePolicy, overrideState, overrideStorage, overrideSwarm, overrideTool, overrideWiki, question, questionForce, runStateless, runStatelessForce,
|
|
22756
|
+
export { Adapter, Chat, Compute, ExecutionContextService, History, HistoryMemoryInstance, HistoryPersistInstance, Logger, LoggerInstance, MCP, MethodContextService, Operator, OperatorInstance, PayloadContextService, PersistAlive, PersistBase, PersistEmbedding, PersistList, PersistMemory, PersistPolicy, PersistState, PersistStorage, PersistSwarm, Policy, RoundRobin, Schema, SharedCompute, SharedState, SharedStorage, State, Storage, Utils, addAgent, addAgentNavigation, addCompletion, addCompute, addEmbedding, addMCP, addPipeline, addPolicy, addState, addStorage, addSwarm, addTool, addTriageNavigation, addWiki, beginContext, cancelOutput, cancelOutputForce, changeToAgent, changeToDefaultAgent, changeToPrevAgent, commitAssistantMessage, commitAssistantMessageForce, commitFlush, commitFlushForce, commitStopTools, commitStopToolsForce, commitSystemMessage, commitSystemMessageForce, commitToolOutput, commitToolOutputForce, commitUserMessage, commitUserMessageForce, complete, createNavigateToAgent, createNavigateToTriageAgent, disposeConnection, dumpAgent, dumpClientPerformance, dumpDocs, dumpPerfomance, dumpSwarm, emit, emitForce, event, execute, executeForce, fork, getAgentHistory, getAgentName, getAssistantHistory, getLastAssistantMessage, getLastSystemMessage, getLastUserMessage, getNavigationRoute, getPayload, getRawHistory, getSessionContext, getSessionMode, getUserHistory, hasNavigation, hasSession, listenAgentEvent, listenAgentEventOnce, listenEvent, listenEventOnce, listenExecutionEvent, listenExecutionEventOnce, listenHistoryEvent, listenHistoryEventOnce, listenPolicyEvent, listenPolicyEventOnce, listenSessionEvent, listenSessionEventOnce, listenStateEvent, listenStateEventOnce, listenStorageEvent, listenStorageEventOnce, listenSwarmEvent, listenSwarmEventOnce, makeAutoDispose, makeConnection, markOffline, markOnline, notify, notifyForce, overrideAgent, overrideCompletion, overrideCompute, overrideEmbeding, overrideMCP, overridePipeline, overridePolicy, overrideState, overrideStorage, overrideSwarm, overrideTool, overrideWiki, question, questionForce, runStateless, runStatelessForce, session, setConfig, startPipeline, swarm };
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -11773,7 +11773,7 @@ interface IScopeOptions {
|
|
|
11773
11773
|
onError?: (error: Error) => void;
|
|
11774
11774
|
}
|
|
11775
11775
|
/**
|
|
11776
|
-
* @function
|
|
11776
|
+
* @function fork
|
|
11777
11777
|
* @description Executes a provided function within a managed scope, handling session creation, validation, and cleanup.
|
|
11778
11778
|
* @template T - Type of the result returned by the run function.
|
|
11779
11779
|
* @param {Function} runFn - The function to execute, receiving clientId and agentName as arguments.
|
|
@@ -11781,7 +11781,7 @@ interface IScopeOptions {
|
|
|
11781
11781
|
* @returns {Promise<T | void>} The result of the run function or void if no result is returned.
|
|
11782
11782
|
* @throws {Error} If a session already exists for the clientId.
|
|
11783
11783
|
*/
|
|
11784
|
-
declare const
|
|
11784
|
+
declare const fork: <T = any>(runFn: (clientId: string, agentName: AgentName) => Promise<T | void>, options: IScopeOptions) => Promise<T | void>;
|
|
11785
11785
|
|
|
11786
11786
|
/**
|
|
11787
11787
|
* @module startPipeline
|
|
@@ -14135,4 +14135,4 @@ declare const Utils: {
|
|
|
14135
14135
|
PersistEmbeddingUtils: typeof PersistEmbeddingUtils;
|
|
14136
14136
|
};
|
|
14137
14137
|
|
|
14138
|
-
export { Adapter, Chat, Compute, type EventSource, ExecutionContextService, History, HistoryMemoryInstance, HistoryPersistInstance, type IAgentSchema, type IAgentTool, type IBaseEvent, type IBusEvent, type IBusEventContext, type IChatArgs, type IChatInstance, type IChatInstanceCallbacks, type ICompletionArgs, type ICompletionSchema, type IComputeSchema, type ICustomEvent, type IEmbeddingSchema, type IGlobalConfig, type IHistoryAdapter, type IHistoryControl, type IHistoryInstance, type IHistoryInstanceCallbacks, type IIncomingMessage, type ILoggerAdapter, type ILoggerInstance, type ILoggerInstanceCallbacks, type IMCPSchema, type IMCPTool, type IMCPToolCallDto, type IMakeConnectionConfig, type IMakeDisposeParams, type IModelMessage, type INavigateToAgentParams, type INavigateToTriageParams, type IOutgoingMessage, type IPersistActiveAgentData, type IPersistAliveData, type IPersistBase, type IPersistEmbeddingData, type IPersistMemoryData, type IPersistNavigationStackData, type IPersistPolicyData, type IPersistStateData, type IPersistStorageData, type IPipelineSchema, type IPolicySchema, type ISessionConfig, type IStateSchema, type IStorageData, type IStorageSchema, type ISwarmSchema, type ITool, type IToolCall, type IWikiSchema, Logger, LoggerInstance, MCP, type MCPToolProperties, MethodContextService, Operator, OperatorInstance, PayloadContextService, PersistAlive, PersistBase, PersistEmbedding, PersistList, PersistMemory, PersistPolicy, PersistState, PersistStorage, PersistSwarm, Policy, type ReceiveMessageFn, RoundRobin, Schema, type SendMessageFn, SharedCompute, SharedState, SharedStorage, State, Storage, type THistoryInstanceCtor, type THistoryMemoryInstance, type THistoryPersistInstance, type TLoggerInstance, type TOperatorInstance, type TPersistBase, type TPersistBaseCtor, type TPersistList, type ToolValue, Utils, addAgent, addAgentNavigation, addCompletion, addCompute, addEmbedding, addMCP, addPipeline, addPolicy, addState, addStorage, addSwarm, addTool, addTriageNavigation, addWiki, beginContext, cancelOutput, cancelOutputForce, changeToAgent, changeToDefaultAgent, changeToPrevAgent, commitAssistantMessage, commitAssistantMessageForce, commitFlush, commitFlushForce, commitStopTools, commitStopToolsForce, commitSystemMessage, commitSystemMessageForce, commitToolOutput, commitToolOutputForce, commitUserMessage, commitUserMessageForce, complete, createNavigateToAgent, createNavigateToTriageAgent, disposeConnection, dumpAgent, dumpClientPerformance, dumpDocs, dumpPerfomance, dumpSwarm, emit, emitForce, event, execute, executeForce, getAgentHistory, getAgentName, getAssistantHistory, getLastAssistantMessage, getLastSystemMessage, getLastUserMessage, getNavigationRoute, getPayload, getRawHistory, getSessionContext, getSessionMode, getUserHistory, hasNavigation, hasSession, listenAgentEvent, listenAgentEventOnce, listenEvent, listenEventOnce, listenExecutionEvent, listenExecutionEventOnce, listenHistoryEvent, listenHistoryEventOnce, listenPolicyEvent, listenPolicyEventOnce, listenSessionEvent, listenSessionEventOnce, listenStateEvent, listenStateEventOnce, listenStorageEvent, listenStorageEventOnce, listenSwarmEvent, listenSwarmEventOnce, makeAutoDispose, makeConnection, markOffline, markOnline, notify, notifyForce, overrideAgent, overrideCompletion, overrideCompute, overrideEmbeding, overrideMCP, overridePipeline, overridePolicy, overrideState, overrideStorage, overrideSwarm, overrideTool, overrideWiki, question, questionForce, runStateless, runStatelessForce,
|
|
14138
|
+
export { Adapter, Chat, Compute, type EventSource, ExecutionContextService, History, HistoryMemoryInstance, HistoryPersistInstance, type IAgentSchema, type IAgentTool, type IBaseEvent, type IBusEvent, type IBusEventContext, type IChatArgs, type IChatInstance, type IChatInstanceCallbacks, type ICompletionArgs, type ICompletionSchema, type IComputeSchema, type ICustomEvent, type IEmbeddingSchema, type IGlobalConfig, type IHistoryAdapter, type IHistoryControl, type IHistoryInstance, type IHistoryInstanceCallbacks, type IIncomingMessage, type ILoggerAdapter, type ILoggerInstance, type ILoggerInstanceCallbacks, type IMCPSchema, type IMCPTool, type IMCPToolCallDto, type IMakeConnectionConfig, type IMakeDisposeParams, type IModelMessage, type INavigateToAgentParams, type INavigateToTriageParams, type IOutgoingMessage, type IPersistActiveAgentData, type IPersistAliveData, type IPersistBase, type IPersistEmbeddingData, type IPersistMemoryData, type IPersistNavigationStackData, type IPersistPolicyData, type IPersistStateData, type IPersistStorageData, type IPipelineSchema, type IPolicySchema, type ISessionConfig, type IStateSchema, type IStorageData, type IStorageSchema, type ISwarmSchema, type ITool, type IToolCall, type IWikiSchema, Logger, LoggerInstance, MCP, type MCPToolProperties, MethodContextService, Operator, OperatorInstance, PayloadContextService, PersistAlive, PersistBase, PersistEmbedding, PersistList, PersistMemory, PersistPolicy, PersistState, PersistStorage, PersistSwarm, Policy, type ReceiveMessageFn, RoundRobin, Schema, type SendMessageFn, SharedCompute, SharedState, SharedStorage, State, Storage, type THistoryInstanceCtor, type THistoryMemoryInstance, type THistoryPersistInstance, type TLoggerInstance, type TOperatorInstance, type TPersistBase, type TPersistBaseCtor, type TPersistList, type ToolValue, Utils, addAgent, addAgentNavigation, addCompletion, addCompute, addEmbedding, addMCP, addPipeline, addPolicy, addState, addStorage, addSwarm, addTool, addTriageNavigation, addWiki, beginContext, cancelOutput, cancelOutputForce, changeToAgent, changeToDefaultAgent, changeToPrevAgent, commitAssistantMessage, commitAssistantMessageForce, commitFlush, commitFlushForce, commitStopTools, commitStopToolsForce, commitSystemMessage, commitSystemMessageForce, commitToolOutput, commitToolOutputForce, commitUserMessage, commitUserMessageForce, complete, createNavigateToAgent, createNavigateToTriageAgent, disposeConnection, dumpAgent, dumpClientPerformance, dumpDocs, dumpPerfomance, dumpSwarm, emit, emitForce, event, execute, executeForce, fork, getAgentHistory, getAgentName, getAssistantHistory, getLastAssistantMessage, getLastSystemMessage, getLastUserMessage, getNavigationRoute, getPayload, getRawHistory, getSessionContext, getSessionMode, getUserHistory, hasNavigation, hasSession, listenAgentEvent, listenAgentEventOnce, listenEvent, listenEventOnce, listenExecutionEvent, listenExecutionEventOnce, listenHistoryEvent, listenHistoryEventOnce, listenPolicyEvent, listenPolicyEventOnce, listenSessionEvent, listenSessionEventOnce, listenStateEvent, listenStateEventOnce, listenStorageEvent, listenStorageEventOnce, listenSwarmEvent, listenSwarmEventOnce, makeAutoDispose, makeConnection, markOffline, markOnline, notify, notifyForce, overrideAgent, overrideCompletion, overrideCompute, overrideEmbeding, overrideMCP, overridePipeline, overridePolicy, overrideState, overrideStorage, overrideSwarm, overrideTool, overrideWiki, question, questionForce, runStateless, runStatelessForce, session, setConfig, startPipeline, swarm };
|