agent-swarm-kit 1.0.201 → 1.0.202
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 +67 -30
- package/build/index.mjs +67 -30
- package/package.json +1 -1
- package/types.d.ts +23 -14
package/build/index.cjs
CHANGED
|
@@ -16852,17 +16852,21 @@ class SharedStateUtils {
|
|
|
16852
16852
|
*/
|
|
16853
16853
|
const SharedState = new SharedStateUtils();
|
|
16854
16854
|
|
|
16855
|
-
/** @constant {string} */
|
|
16855
|
+
/** @constant {string} Method name for beginning a chat in ChatUtils */
|
|
16856
|
+
const CHAT_UTILS_METHOD_NAME_BEGIN_CHAT = "ChatUtils.beginChat";
|
|
16857
|
+
/** @constant {string} Method name for sending a message in ChatUtils */
|
|
16856
16858
|
const CHAT_UTILS_METHOD_NAME_SEND_MESSAGE = "ChatUtils.sendMessage";
|
|
16857
|
-
/** @constant {string} */
|
|
16859
|
+
/** @constant {string} Method name for listening to dispose events in ChatUtils */
|
|
16858
16860
|
const CHAT_UTILS_METHOD_NAME_LISTEN_DISPOSE = "ChatUtils.listenDispose";
|
|
16859
|
-
/** @constant {string} */
|
|
16861
|
+
/** @constant {string} Method name for disposing a chat in ChatUtils */
|
|
16860
16862
|
const CHAT_UTILS_METHOD_NAME_DISPOSE = "ChatUtils.dispose";
|
|
16861
|
-
/** @constant {string} */
|
|
16863
|
+
/** @constant {string} Method name for beginning a chat in ChatInstance */
|
|
16864
|
+
const CHAT_INSTANCE_METHOD_NAME_BEGIN_CHAT = "ChatInstance.beginChat";
|
|
16865
|
+
/** @constant {string} Method name for sending a message in ChatInstance */
|
|
16862
16866
|
const CHAT_INSTANCE_METHOD_NAME_SEND_MESSAGE = "ChatInstance.sendMessage";
|
|
16863
|
-
/** @constant {string} */
|
|
16867
|
+
/** @constant {string} Method name for disposing a chat in ChatInstance */
|
|
16864
16868
|
const CHAT_INSTANCE_METHOD_NAME_DISPOSE = "ChatInstance.dispose";
|
|
16865
|
-
/** @constant {string} */
|
|
16869
|
+
/** @constant {string} Method name for listening to dispose events in ChatInstance */
|
|
16866
16870
|
const CHAT_INSTANCE_METHOD_NAME_LISTEN_DISPOSE = "ChatInstance.listenDispose";
|
|
16867
16871
|
/** @constant {number} Time interval in milliseconds for inactivity checks (1 minute) */
|
|
16868
16872
|
const INACTIVITY_CHECK = 60 * 1000;
|
|
@@ -16876,16 +16880,17 @@ class ChatInstance {
|
|
|
16876
16880
|
/**
|
|
16877
16881
|
* Gets the timestamp of the last activity
|
|
16878
16882
|
* @public
|
|
16879
|
-
* @returns {number} Last activity timestamp
|
|
16883
|
+
* @returns {number} Last activity timestamp in milliseconds
|
|
16880
16884
|
*/
|
|
16881
16885
|
get lastActivity() {
|
|
16882
16886
|
return this._lastActivity;
|
|
16883
16887
|
}
|
|
16884
16888
|
/**
|
|
16885
16889
|
* Creates a new ChatInstance
|
|
16886
|
-
* @
|
|
16887
|
-
* @param {
|
|
16888
|
-
* @param {
|
|
16890
|
+
* @constructor
|
|
16891
|
+
* @param {SessionId} clientId - Unique identifier for the client
|
|
16892
|
+
* @param {SwarmName} swarmName - Name of the swarm this chat belongs to
|
|
16893
|
+
* @param {DisposeFn} onDispose - Callback function executed when chat is disposed
|
|
16889
16894
|
*/
|
|
16890
16895
|
constructor(clientId, swarmName, onDispose) {
|
|
16891
16896
|
this.clientId = clientId;
|
|
@@ -16895,11 +16900,26 @@ class ChatInstance {
|
|
|
16895
16900
|
this.disposeSubject = new functoolsKit.Subject();
|
|
16896
16901
|
/** @private @type {number} Timestamp of last activity */
|
|
16897
16902
|
this._lastActivity = Date.now();
|
|
16903
|
+
/**
|
|
16904
|
+
* Initiates the chat session
|
|
16905
|
+
* @public
|
|
16906
|
+
* @async
|
|
16907
|
+
* @returns {Promise<void>} Promise that resolves when chat is initiated
|
|
16908
|
+
*/
|
|
16909
|
+
this.beginChat = () => {
|
|
16910
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
16911
|
+
swarm$1.loggerService.debug(CHAT_INSTANCE_METHOD_NAME_BEGIN_CHAT, {
|
|
16912
|
+
clientId: this.clientId,
|
|
16913
|
+
swarmName: this.swarmName,
|
|
16914
|
+
timestamp: new Date().toISOString(),
|
|
16915
|
+
});
|
|
16916
|
+
return Promise.resolve();
|
|
16917
|
+
};
|
|
16898
16918
|
/**
|
|
16899
16919
|
* Sends a message through the chat session
|
|
16900
16920
|
* @public
|
|
16901
16921
|
* @async
|
|
16902
|
-
* @param {string} content -
|
|
16922
|
+
* @param {string} content - The message content to send
|
|
16903
16923
|
* @returns {Promise<any>} Result of the message completion
|
|
16904
16924
|
*/
|
|
16905
16925
|
this.sendMessage = async (content) => {
|
|
@@ -16914,10 +16934,10 @@ class ChatInstance {
|
|
|
16914
16934
|
return await this.chatSession.complete(content);
|
|
16915
16935
|
};
|
|
16916
16936
|
/**
|
|
16917
|
-
* Disposes of the chat instance
|
|
16937
|
+
* Disposes of the chat instance and cleans up resources
|
|
16918
16938
|
* @public
|
|
16919
16939
|
* @async
|
|
16920
|
-
* @returns {Promise<void>}
|
|
16940
|
+
* @returns {Promise<void>} Promise that resolves when disposal is complete
|
|
16921
16941
|
*/
|
|
16922
16942
|
this.dispose = async () => {
|
|
16923
16943
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
@@ -16930,10 +16950,10 @@ class ChatInstance {
|
|
|
16930
16950
|
await this.chatSession.dispose();
|
|
16931
16951
|
};
|
|
16932
16952
|
/**
|
|
16933
|
-
* Subscribes to disposal events
|
|
16953
|
+
* Subscribes to disposal events for this chat instance
|
|
16934
16954
|
* @public
|
|
16935
|
-
* @param {(clientId: SessionId) => void} fn - Callback function
|
|
16936
|
-
* @returns {any} Subscription object
|
|
16955
|
+
* @param {(clientId: SessionId) => void} fn - Callback function to execute on disposal
|
|
16956
|
+
* @returns {any} Subscription object for managing the subscription
|
|
16937
16957
|
*/
|
|
16938
16958
|
this.listenDispose = (fn) => {
|
|
16939
16959
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
@@ -16975,9 +16995,9 @@ class ChatUtils {
|
|
|
16975
16995
|
/**
|
|
16976
16996
|
* Gets or creates a chat instance for a client
|
|
16977
16997
|
* @private
|
|
16978
|
-
* @param {SessionId} clientId -
|
|
16979
|
-
* @param {SwarmName} swarmName -
|
|
16980
|
-
* @returns {ChatInstance}
|
|
16998
|
+
* @param {SessionId} clientId - Unique identifier for the client
|
|
16999
|
+
* @param {SwarmName} swarmName - Name of the swarm
|
|
17000
|
+
* @returns {ChatInstance} Existing or new chat instance for the client
|
|
16981
17001
|
*/
|
|
16982
17002
|
this.getChatInstance = (clientId, swarmName) => {
|
|
16983
17003
|
return this._chats.has(clientId)
|
|
@@ -16988,14 +17008,31 @@ class ChatUtils {
|
|
|
16988
17008
|
}))
|
|
16989
17009
|
.get(clientId);
|
|
16990
17010
|
};
|
|
17011
|
+
/**
|
|
17012
|
+
* Begins a chat session for a client
|
|
17013
|
+
* @public
|
|
17014
|
+
* @async
|
|
17015
|
+
* @param {SessionId} clientId - Unique identifier for the client
|
|
17016
|
+
* @param {SwarmName} swarmName - Name of the swarm
|
|
17017
|
+
* @returns {Promise<void>} Promise that resolves when chat begins
|
|
17018
|
+
*/
|
|
17019
|
+
this.beginChat = async (clientId, swarmName) => {
|
|
17020
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17021
|
+
swarm$1.loggerService.log(CHAT_UTILS_METHOD_NAME_BEGIN_CHAT, {
|
|
17022
|
+
clientId,
|
|
17023
|
+
swarmName,
|
|
17024
|
+
});
|
|
17025
|
+
this.initializeCleanup();
|
|
17026
|
+
return await this.getChatInstance(clientId, swarmName).beginChat();
|
|
17027
|
+
};
|
|
16991
17028
|
/**
|
|
16992
17029
|
* Sends a message for a specific client
|
|
16993
17030
|
* @public
|
|
16994
17031
|
* @async
|
|
16995
|
-
* @param {SessionId} clientId -
|
|
17032
|
+
* @param {SessionId} clientId - Unique identifier for the client
|
|
16996
17033
|
* @param {string} message - Message content to send
|
|
16997
|
-
* @param {SwarmName} swarmName -
|
|
16998
|
-
* @returns {Promise<any>} Result of the message sending
|
|
17034
|
+
* @param {SwarmName} swarmName - Name of the swarm
|
|
17035
|
+
* @returns {Promise<any>} Result of the message sending operation
|
|
16999
17036
|
*/
|
|
17000
17037
|
this.sendMessage = async (clientId, message, swarmName) => {
|
|
17001
17038
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
@@ -17008,12 +17045,12 @@ class ChatUtils {
|
|
|
17008
17045
|
return await this.getChatInstance(clientId, swarmName).sendMessage(message);
|
|
17009
17046
|
};
|
|
17010
17047
|
/**
|
|
17011
|
-
* Subscribes to disposal events for a specific client
|
|
17048
|
+
* Subscribes to disposal events for a specific client's chat
|
|
17012
17049
|
* @public
|
|
17013
|
-
* @param {SessionId} clientId -
|
|
17014
|
-
* @param {SwarmName} swarmName -
|
|
17050
|
+
* @param {SessionId} clientId - Unique identifier for the client
|
|
17051
|
+
* @param {SwarmName} swarmName - Name of the swarm
|
|
17015
17052
|
* @param {(clientId: SessionId) => void} fn - Callback function for disposal events
|
|
17016
|
-
* @returns {any} Subscription object
|
|
17053
|
+
* @returns {any} Subscription object for managing the subscription
|
|
17017
17054
|
*/
|
|
17018
17055
|
this.listenDispose = (clientId, swarmName, fn) => {
|
|
17019
17056
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
@@ -17027,9 +17064,9 @@ class ChatUtils {
|
|
|
17027
17064
|
* Disposes of a specific chat instance for a client
|
|
17028
17065
|
* @public
|
|
17029
17066
|
* @async
|
|
17030
|
-
* @param {SessionId} clientId -
|
|
17031
|
-
* @param {SwarmName} swarmName -
|
|
17032
|
-
* @returns {Promise<void>}
|
|
17067
|
+
* @param {SessionId} clientId - Unique identifier for the client
|
|
17068
|
+
* @param {SwarmName} swarmName - Name of the swarm
|
|
17069
|
+
* @returns {Promise<void>} Promise that resolves when disposal is complete
|
|
17033
17070
|
*/
|
|
17034
17071
|
this.dispose = async (clientId, swarmName) => {
|
|
17035
17072
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
@@ -17044,7 +17081,7 @@ class ChatUtils {
|
|
|
17044
17081
|
};
|
|
17045
17082
|
}
|
|
17046
17083
|
}
|
|
17047
|
-
/** @constant {ChatUtils} Singleton instance of ChatUtils */
|
|
17084
|
+
/** @constant {ChatUtils} Singleton instance of ChatUtils for application-wide use */
|
|
17048
17085
|
const Chat = new ChatUtils();
|
|
17049
17086
|
|
|
17050
17087
|
/** @private Constant for logging the take method in StorageUtils */
|
package/build/index.mjs
CHANGED
|
@@ -16850,17 +16850,21 @@ class SharedStateUtils {
|
|
|
16850
16850
|
*/
|
|
16851
16851
|
const SharedState = new SharedStateUtils();
|
|
16852
16852
|
|
|
16853
|
-
/** @constant {string} */
|
|
16853
|
+
/** @constant {string} Method name for beginning a chat in ChatUtils */
|
|
16854
|
+
const CHAT_UTILS_METHOD_NAME_BEGIN_CHAT = "ChatUtils.beginChat";
|
|
16855
|
+
/** @constant {string} Method name for sending a message in ChatUtils */
|
|
16854
16856
|
const CHAT_UTILS_METHOD_NAME_SEND_MESSAGE = "ChatUtils.sendMessage";
|
|
16855
|
-
/** @constant {string} */
|
|
16857
|
+
/** @constant {string} Method name for listening to dispose events in ChatUtils */
|
|
16856
16858
|
const CHAT_UTILS_METHOD_NAME_LISTEN_DISPOSE = "ChatUtils.listenDispose";
|
|
16857
|
-
/** @constant {string} */
|
|
16859
|
+
/** @constant {string} Method name for disposing a chat in ChatUtils */
|
|
16858
16860
|
const CHAT_UTILS_METHOD_NAME_DISPOSE = "ChatUtils.dispose";
|
|
16859
|
-
/** @constant {string} */
|
|
16861
|
+
/** @constant {string} Method name for beginning a chat in ChatInstance */
|
|
16862
|
+
const CHAT_INSTANCE_METHOD_NAME_BEGIN_CHAT = "ChatInstance.beginChat";
|
|
16863
|
+
/** @constant {string} Method name for sending a message in ChatInstance */
|
|
16860
16864
|
const CHAT_INSTANCE_METHOD_NAME_SEND_MESSAGE = "ChatInstance.sendMessage";
|
|
16861
|
-
/** @constant {string} */
|
|
16865
|
+
/** @constant {string} Method name for disposing a chat in ChatInstance */
|
|
16862
16866
|
const CHAT_INSTANCE_METHOD_NAME_DISPOSE = "ChatInstance.dispose";
|
|
16863
|
-
/** @constant {string} */
|
|
16867
|
+
/** @constant {string} Method name for listening to dispose events in ChatInstance */
|
|
16864
16868
|
const CHAT_INSTANCE_METHOD_NAME_LISTEN_DISPOSE = "ChatInstance.listenDispose";
|
|
16865
16869
|
/** @constant {number} Time interval in milliseconds for inactivity checks (1 minute) */
|
|
16866
16870
|
const INACTIVITY_CHECK = 60 * 1000;
|
|
@@ -16874,16 +16878,17 @@ class ChatInstance {
|
|
|
16874
16878
|
/**
|
|
16875
16879
|
* Gets the timestamp of the last activity
|
|
16876
16880
|
* @public
|
|
16877
|
-
* @returns {number} Last activity timestamp
|
|
16881
|
+
* @returns {number} Last activity timestamp in milliseconds
|
|
16878
16882
|
*/
|
|
16879
16883
|
get lastActivity() {
|
|
16880
16884
|
return this._lastActivity;
|
|
16881
16885
|
}
|
|
16882
16886
|
/**
|
|
16883
16887
|
* Creates a new ChatInstance
|
|
16884
|
-
* @
|
|
16885
|
-
* @param {
|
|
16886
|
-
* @param {
|
|
16888
|
+
* @constructor
|
|
16889
|
+
* @param {SessionId} clientId - Unique identifier for the client
|
|
16890
|
+
* @param {SwarmName} swarmName - Name of the swarm this chat belongs to
|
|
16891
|
+
* @param {DisposeFn} onDispose - Callback function executed when chat is disposed
|
|
16887
16892
|
*/
|
|
16888
16893
|
constructor(clientId, swarmName, onDispose) {
|
|
16889
16894
|
this.clientId = clientId;
|
|
@@ -16893,11 +16898,26 @@ class ChatInstance {
|
|
|
16893
16898
|
this.disposeSubject = new Subject();
|
|
16894
16899
|
/** @private @type {number} Timestamp of last activity */
|
|
16895
16900
|
this._lastActivity = Date.now();
|
|
16901
|
+
/**
|
|
16902
|
+
* Initiates the chat session
|
|
16903
|
+
* @public
|
|
16904
|
+
* @async
|
|
16905
|
+
* @returns {Promise<void>} Promise that resolves when chat is initiated
|
|
16906
|
+
*/
|
|
16907
|
+
this.beginChat = () => {
|
|
16908
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
16909
|
+
swarm$1.loggerService.debug(CHAT_INSTANCE_METHOD_NAME_BEGIN_CHAT, {
|
|
16910
|
+
clientId: this.clientId,
|
|
16911
|
+
swarmName: this.swarmName,
|
|
16912
|
+
timestamp: new Date().toISOString(),
|
|
16913
|
+
});
|
|
16914
|
+
return Promise.resolve();
|
|
16915
|
+
};
|
|
16896
16916
|
/**
|
|
16897
16917
|
* Sends a message through the chat session
|
|
16898
16918
|
* @public
|
|
16899
16919
|
* @async
|
|
16900
|
-
* @param {string} content -
|
|
16920
|
+
* @param {string} content - The message content to send
|
|
16901
16921
|
* @returns {Promise<any>} Result of the message completion
|
|
16902
16922
|
*/
|
|
16903
16923
|
this.sendMessage = async (content) => {
|
|
@@ -16912,10 +16932,10 @@ class ChatInstance {
|
|
|
16912
16932
|
return await this.chatSession.complete(content);
|
|
16913
16933
|
};
|
|
16914
16934
|
/**
|
|
16915
|
-
* Disposes of the chat instance
|
|
16935
|
+
* Disposes of the chat instance and cleans up resources
|
|
16916
16936
|
* @public
|
|
16917
16937
|
* @async
|
|
16918
|
-
* @returns {Promise<void>}
|
|
16938
|
+
* @returns {Promise<void>} Promise that resolves when disposal is complete
|
|
16919
16939
|
*/
|
|
16920
16940
|
this.dispose = async () => {
|
|
16921
16941
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
@@ -16928,10 +16948,10 @@ class ChatInstance {
|
|
|
16928
16948
|
await this.chatSession.dispose();
|
|
16929
16949
|
};
|
|
16930
16950
|
/**
|
|
16931
|
-
* Subscribes to disposal events
|
|
16951
|
+
* Subscribes to disposal events for this chat instance
|
|
16932
16952
|
* @public
|
|
16933
|
-
* @param {(clientId: SessionId) => void} fn - Callback function
|
|
16934
|
-
* @returns {any} Subscription object
|
|
16953
|
+
* @param {(clientId: SessionId) => void} fn - Callback function to execute on disposal
|
|
16954
|
+
* @returns {any} Subscription object for managing the subscription
|
|
16935
16955
|
*/
|
|
16936
16956
|
this.listenDispose = (fn) => {
|
|
16937
16957
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
@@ -16973,9 +16993,9 @@ class ChatUtils {
|
|
|
16973
16993
|
/**
|
|
16974
16994
|
* Gets or creates a chat instance for a client
|
|
16975
16995
|
* @private
|
|
16976
|
-
* @param {SessionId} clientId -
|
|
16977
|
-
* @param {SwarmName} swarmName -
|
|
16978
|
-
* @returns {ChatInstance}
|
|
16996
|
+
* @param {SessionId} clientId - Unique identifier for the client
|
|
16997
|
+
* @param {SwarmName} swarmName - Name of the swarm
|
|
16998
|
+
* @returns {ChatInstance} Existing or new chat instance for the client
|
|
16979
16999
|
*/
|
|
16980
17000
|
this.getChatInstance = (clientId, swarmName) => {
|
|
16981
17001
|
return this._chats.has(clientId)
|
|
@@ -16986,14 +17006,31 @@ class ChatUtils {
|
|
|
16986
17006
|
}))
|
|
16987
17007
|
.get(clientId);
|
|
16988
17008
|
};
|
|
17009
|
+
/**
|
|
17010
|
+
* Begins a chat session for a client
|
|
17011
|
+
* @public
|
|
17012
|
+
* @async
|
|
17013
|
+
* @param {SessionId} clientId - Unique identifier for the client
|
|
17014
|
+
* @param {SwarmName} swarmName - Name of the swarm
|
|
17015
|
+
* @returns {Promise<void>} Promise that resolves when chat begins
|
|
17016
|
+
*/
|
|
17017
|
+
this.beginChat = async (clientId, swarmName) => {
|
|
17018
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17019
|
+
swarm$1.loggerService.log(CHAT_UTILS_METHOD_NAME_BEGIN_CHAT, {
|
|
17020
|
+
clientId,
|
|
17021
|
+
swarmName,
|
|
17022
|
+
});
|
|
17023
|
+
this.initializeCleanup();
|
|
17024
|
+
return await this.getChatInstance(clientId, swarmName).beginChat();
|
|
17025
|
+
};
|
|
16989
17026
|
/**
|
|
16990
17027
|
* Sends a message for a specific client
|
|
16991
17028
|
* @public
|
|
16992
17029
|
* @async
|
|
16993
|
-
* @param {SessionId} clientId -
|
|
17030
|
+
* @param {SessionId} clientId - Unique identifier for the client
|
|
16994
17031
|
* @param {string} message - Message content to send
|
|
16995
|
-
* @param {SwarmName} swarmName -
|
|
16996
|
-
* @returns {Promise<any>} Result of the message sending
|
|
17032
|
+
* @param {SwarmName} swarmName - Name of the swarm
|
|
17033
|
+
* @returns {Promise<any>} Result of the message sending operation
|
|
16997
17034
|
*/
|
|
16998
17035
|
this.sendMessage = async (clientId, message, swarmName) => {
|
|
16999
17036
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
@@ -17006,12 +17043,12 @@ class ChatUtils {
|
|
|
17006
17043
|
return await this.getChatInstance(clientId, swarmName).sendMessage(message);
|
|
17007
17044
|
};
|
|
17008
17045
|
/**
|
|
17009
|
-
* Subscribes to disposal events for a specific client
|
|
17046
|
+
* Subscribes to disposal events for a specific client's chat
|
|
17010
17047
|
* @public
|
|
17011
|
-
* @param {SessionId} clientId -
|
|
17012
|
-
* @param {SwarmName} swarmName -
|
|
17048
|
+
* @param {SessionId} clientId - Unique identifier for the client
|
|
17049
|
+
* @param {SwarmName} swarmName - Name of the swarm
|
|
17013
17050
|
* @param {(clientId: SessionId) => void} fn - Callback function for disposal events
|
|
17014
|
-
* @returns {any} Subscription object
|
|
17051
|
+
* @returns {any} Subscription object for managing the subscription
|
|
17015
17052
|
*/
|
|
17016
17053
|
this.listenDispose = (clientId, swarmName, fn) => {
|
|
17017
17054
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
@@ -17025,9 +17062,9 @@ class ChatUtils {
|
|
|
17025
17062
|
* Disposes of a specific chat instance for a client
|
|
17026
17063
|
* @public
|
|
17027
17064
|
* @async
|
|
17028
|
-
* @param {SessionId} clientId -
|
|
17029
|
-
* @param {SwarmName} swarmName -
|
|
17030
|
-
* @returns {Promise<void>}
|
|
17065
|
+
* @param {SessionId} clientId - Unique identifier for the client
|
|
17066
|
+
* @param {SwarmName} swarmName - Name of the swarm
|
|
17067
|
+
* @returns {Promise<void>} Promise that resolves when disposal is complete
|
|
17031
17068
|
*/
|
|
17032
17069
|
this.dispose = async (clientId, swarmName) => {
|
|
17033
17070
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
@@ -17042,7 +17079,7 @@ class ChatUtils {
|
|
|
17042
17079
|
};
|
|
17043
17080
|
}
|
|
17044
17081
|
}
|
|
17045
|
-
/** @constant {ChatUtils} Singleton instance of ChatUtils */
|
|
17082
|
+
/** @constant {ChatUtils} Singleton instance of ChatUtils for application-wide use */
|
|
17046
17083
|
const Chat = new ChatUtils();
|
|
17047
17084
|
|
|
17048
17085
|
/** @private Constant for logging the take method in StorageUtils */
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -10485,41 +10485,50 @@ declare class ChatUtils {
|
|
|
10485
10485
|
/**
|
|
10486
10486
|
* Gets or creates a chat instance for a client
|
|
10487
10487
|
* @private
|
|
10488
|
-
* @param {SessionId} clientId -
|
|
10489
|
-
* @param {SwarmName} swarmName -
|
|
10490
|
-
* @returns {ChatInstance}
|
|
10488
|
+
* @param {SessionId} clientId - Unique identifier for the client
|
|
10489
|
+
* @param {SwarmName} swarmName - Name of the swarm
|
|
10490
|
+
* @returns {ChatInstance} Existing or new chat instance for the client
|
|
10491
10491
|
*/
|
|
10492
10492
|
private getChatInstance;
|
|
10493
|
+
/**
|
|
10494
|
+
* Begins a chat session for a client
|
|
10495
|
+
* @public
|
|
10496
|
+
* @async
|
|
10497
|
+
* @param {SessionId} clientId - Unique identifier for the client
|
|
10498
|
+
* @param {SwarmName} swarmName - Name of the swarm
|
|
10499
|
+
* @returns {Promise<void>} Promise that resolves when chat begins
|
|
10500
|
+
*/
|
|
10501
|
+
beginChat: (clientId: SessionId, swarmName: SwarmName) => Promise<void>;
|
|
10493
10502
|
/**
|
|
10494
10503
|
* Sends a message for a specific client
|
|
10495
10504
|
* @public
|
|
10496
10505
|
* @async
|
|
10497
|
-
* @param {SessionId} clientId -
|
|
10506
|
+
* @param {SessionId} clientId - Unique identifier for the client
|
|
10498
10507
|
* @param {string} message - Message content to send
|
|
10499
|
-
* @param {SwarmName} swarmName -
|
|
10500
|
-
* @returns {Promise<any>} Result of the message sending
|
|
10508
|
+
* @param {SwarmName} swarmName - Name of the swarm
|
|
10509
|
+
* @returns {Promise<any>} Result of the message sending operation
|
|
10501
10510
|
*/
|
|
10502
10511
|
sendMessage: (clientId: SessionId, message: string, swarmName: SwarmName) => Promise<string>;
|
|
10503
10512
|
/**
|
|
10504
|
-
* Subscribes to disposal events for a specific client
|
|
10513
|
+
* Subscribes to disposal events for a specific client's chat
|
|
10505
10514
|
* @public
|
|
10506
|
-
* @param {SessionId} clientId -
|
|
10507
|
-
* @param {SwarmName} swarmName -
|
|
10515
|
+
* @param {SessionId} clientId - Unique identifier for the client
|
|
10516
|
+
* @param {SwarmName} swarmName - Name of the swarm
|
|
10508
10517
|
* @param {(clientId: SessionId) => void} fn - Callback function for disposal events
|
|
10509
|
-
* @returns {any} Subscription object
|
|
10518
|
+
* @returns {any} Subscription object for managing the subscription
|
|
10510
10519
|
*/
|
|
10511
10520
|
listenDispose: (clientId: SessionId, swarmName: SwarmName, fn: (clientId: SessionId) => void) => () => void;
|
|
10512
10521
|
/**
|
|
10513
10522
|
* Disposes of a specific chat instance for a client
|
|
10514
10523
|
* @public
|
|
10515
10524
|
* @async
|
|
10516
|
-
* @param {SessionId} clientId -
|
|
10517
|
-
* @param {SwarmName} swarmName -
|
|
10518
|
-
* @returns {Promise<void>}
|
|
10525
|
+
* @param {SessionId} clientId - Unique identifier for the client
|
|
10526
|
+
* @param {SwarmName} swarmName - Name of the swarm
|
|
10527
|
+
* @returns {Promise<void>} Promise that resolves when disposal is complete
|
|
10519
10528
|
*/
|
|
10520
10529
|
dispose: (clientId: SessionId, swarmName: SwarmName) => Promise<void>;
|
|
10521
10530
|
}
|
|
10522
|
-
/** @constant {ChatUtils} Singleton instance of ChatUtils */
|
|
10531
|
+
/** @constant {ChatUtils} Singleton instance of ChatUtils for application-wide use */
|
|
10523
10532
|
declare const Chat: ChatUtils;
|
|
10524
10533
|
|
|
10525
10534
|
/**
|