agent-swarm-kit 1.0.236 → 1.0.237
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 +18 -3
- package/build/index.mjs +18 -3
- package/package.json +1 -1
- package/types.d.ts +7 -0
package/build/index.cjs
CHANGED
|
@@ -2763,6 +2763,8 @@ const Logger = LoggerAdapter;
|
|
|
2763
2763
|
const OPERATOR_INSTANCE_METHOD_NAME_CTOR = "OperatorInstance.CTOR";
|
|
2764
2764
|
/** @private Constant for logging the connectAnswer method in OperatorInstance */
|
|
2765
2765
|
const OPERATOR_INSTANCE_METHOD_NAME_CONNECT_ANSWER = "OperatorInstance.connectAnswer";
|
|
2766
|
+
/** @private Constant for logging the init method in OperatorInstance */
|
|
2767
|
+
const OPERATOR_INSTANCE_METHOD_NAME_INIT = "OperatorInstance.init";
|
|
2766
2768
|
/** @private Constant for logging the notify method in OperatorInstance */
|
|
2767
2769
|
const OPERATOR_INSTANCE_METHOD_NAME_NOTIFY = "OperatorInstance.notify";
|
|
2768
2770
|
/** @private Constant for logging the answer method in OperatorInstance */
|
|
@@ -2806,9 +2808,6 @@ const OperatorInstance = functoolsKit.makeExtendable(class {
|
|
|
2806
2808
|
clientId: this.clientId,
|
|
2807
2809
|
agentName,
|
|
2808
2810
|
});
|
|
2809
|
-
if (this.callbacks.onInit) {
|
|
2810
|
-
this.callbacks.onInit(clientId, agentName);
|
|
2811
|
-
}
|
|
2812
2811
|
}
|
|
2813
2812
|
/**
|
|
2814
2813
|
* Connects an answer subscription
|
|
@@ -2823,6 +2822,20 @@ const OperatorInstance = functoolsKit.makeExtendable(class {
|
|
|
2823
2822
|
this._answerSubject.unsubscribeAll();
|
|
2824
2823
|
this._answerSubject.subscribe(next);
|
|
2825
2824
|
}
|
|
2825
|
+
/**
|
|
2826
|
+
* Init the operator connection
|
|
2827
|
+
* @returns {Promise<void>}
|
|
2828
|
+
*/
|
|
2829
|
+
async init() {
|
|
2830
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
2831
|
+
swarm$1.loggerService.debug(OPERATOR_INSTANCE_METHOD_NAME_INIT, {
|
|
2832
|
+
clientId: this.clientId,
|
|
2833
|
+
agentName: this.agentName,
|
|
2834
|
+
});
|
|
2835
|
+
if (this.callbacks.onInit) {
|
|
2836
|
+
this.callbacks.onInit(this.clientId, this.agentName);
|
|
2837
|
+
}
|
|
2838
|
+
}
|
|
2826
2839
|
/**
|
|
2827
2840
|
* Sends a notification
|
|
2828
2841
|
* @param {string} content - Notification content
|
|
@@ -2945,7 +2958,9 @@ class OperatorUtils {
|
|
|
2945
2958
|
clientId,
|
|
2946
2959
|
agentName,
|
|
2947
2960
|
});
|
|
2961
|
+
const isInitial = this.getOperator.has(`${clientId}-${agentName}`);
|
|
2948
2962
|
const operator = this.getOperator(clientId, agentName);
|
|
2963
|
+
isInitial && operator.init();
|
|
2949
2964
|
return (message, next) => {
|
|
2950
2965
|
operator.connectAnswer(next);
|
|
2951
2966
|
operator.recieveMessage(message);
|
package/build/index.mjs
CHANGED
|
@@ -2761,6 +2761,8 @@ const Logger = LoggerAdapter;
|
|
|
2761
2761
|
const OPERATOR_INSTANCE_METHOD_NAME_CTOR = "OperatorInstance.CTOR";
|
|
2762
2762
|
/** @private Constant for logging the connectAnswer method in OperatorInstance */
|
|
2763
2763
|
const OPERATOR_INSTANCE_METHOD_NAME_CONNECT_ANSWER = "OperatorInstance.connectAnswer";
|
|
2764
|
+
/** @private Constant for logging the init method in OperatorInstance */
|
|
2765
|
+
const OPERATOR_INSTANCE_METHOD_NAME_INIT = "OperatorInstance.init";
|
|
2764
2766
|
/** @private Constant for logging the notify method in OperatorInstance */
|
|
2765
2767
|
const OPERATOR_INSTANCE_METHOD_NAME_NOTIFY = "OperatorInstance.notify";
|
|
2766
2768
|
/** @private Constant for logging the answer method in OperatorInstance */
|
|
@@ -2804,9 +2806,6 @@ const OperatorInstance = makeExtendable(class {
|
|
|
2804
2806
|
clientId: this.clientId,
|
|
2805
2807
|
agentName,
|
|
2806
2808
|
});
|
|
2807
|
-
if (this.callbacks.onInit) {
|
|
2808
|
-
this.callbacks.onInit(clientId, agentName);
|
|
2809
|
-
}
|
|
2810
2809
|
}
|
|
2811
2810
|
/**
|
|
2812
2811
|
* Connects an answer subscription
|
|
@@ -2821,6 +2820,20 @@ const OperatorInstance = makeExtendable(class {
|
|
|
2821
2820
|
this._answerSubject.unsubscribeAll();
|
|
2822
2821
|
this._answerSubject.subscribe(next);
|
|
2823
2822
|
}
|
|
2823
|
+
/**
|
|
2824
|
+
* Init the operator connection
|
|
2825
|
+
* @returns {Promise<void>}
|
|
2826
|
+
*/
|
|
2827
|
+
async init() {
|
|
2828
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
2829
|
+
swarm$1.loggerService.debug(OPERATOR_INSTANCE_METHOD_NAME_INIT, {
|
|
2830
|
+
clientId: this.clientId,
|
|
2831
|
+
agentName: this.agentName,
|
|
2832
|
+
});
|
|
2833
|
+
if (this.callbacks.onInit) {
|
|
2834
|
+
this.callbacks.onInit(this.clientId, this.agentName);
|
|
2835
|
+
}
|
|
2836
|
+
}
|
|
2824
2837
|
/**
|
|
2825
2838
|
* Sends a notification
|
|
2826
2839
|
* @param {string} content - Notification content
|
|
@@ -2943,7 +2956,9 @@ class OperatorUtils {
|
|
|
2943
2956
|
clientId,
|
|
2944
2957
|
agentName,
|
|
2945
2958
|
});
|
|
2959
|
+
const isInitial = this.getOperator.has(`${clientId}-${agentName}`);
|
|
2946
2960
|
const operator = this.getOperator(clientId, agentName);
|
|
2961
|
+
isInitial && operator.init();
|
|
2947
2962
|
return (message, next) => {
|
|
2948
2963
|
operator.connectAnswer(next);
|
|
2949
2964
|
operator.recieveMessage(message);
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -11049,6 +11049,8 @@ interface IOperatorInstance {
|
|
|
11049
11049
|
connectAnswer(next: (answer: string) => void): void;
|
|
11050
11050
|
/** Sends an answer */
|
|
11051
11051
|
answer(content: string): Promise<void>;
|
|
11052
|
+
/** Init the connection */
|
|
11053
|
+
init(): Promise<void>;
|
|
11052
11054
|
/** Sends a notification */
|
|
11053
11055
|
notify(content: string): Promise<void>;
|
|
11054
11056
|
/** Receives a message */
|
|
@@ -11082,6 +11084,11 @@ declare const OperatorInstance: {
|
|
|
11082
11084
|
* @param {(answer: string) => void} next - Answer handler callback
|
|
11083
11085
|
*/
|
|
11084
11086
|
connectAnswer(next: (answer: string) => void): void;
|
|
11087
|
+
/**
|
|
11088
|
+
* Init the operator connection
|
|
11089
|
+
* @returns {Promise<void>}
|
|
11090
|
+
*/
|
|
11091
|
+
init(): Promise<void>;
|
|
11085
11092
|
/**
|
|
11086
11093
|
* Sends a notification
|
|
11087
11094
|
* @param {string} content - Notification content
|