@areumtecnologia/autonomouscustomerserviceagent 2.2.1 → 2.2.3
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@areumtecnologia/autonomouscustomerserviceagent",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.3",
|
|
4
4
|
"description": "Agente autônomo de atendimento ao cliente baseado em IA com Google Gemini API. Suporta múltiplas sessões, ferramentas customizadas e retry com backoff exponencial.",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "Áreum Tecnologia",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"start": "node tests/test.js"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@google/genai": "^2.
|
|
29
|
+
"@google/genai": "^2.6.0",
|
|
30
30
|
"uuid": "^14.0.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
@@ -139,9 +139,13 @@ class AutonomousCustomerServiceAgent extends EventEmitter {
|
|
|
139
139
|
/**
|
|
140
140
|
* Remove uma sessão manualmente.
|
|
141
141
|
* @param {string} sessionId
|
|
142
|
+
* @param {object} options
|
|
143
|
+
* @param {string} [options.reason='manual'] - Motivo da limpeza
|
|
144
|
+
* @param {object} [options.data={}] - Dados adicionais a serem enviados no evento
|
|
145
|
+
* @param {boolean} [options.eventTrigger=true] - Se deve emitir o evento
|
|
142
146
|
* @returns {boolean}
|
|
143
147
|
*/
|
|
144
|
-
clearSession(sessionId) {
|
|
148
|
+
clearSession(sessionId, { reason = 'manual', data = {}, eventTrigger = true } = {}) {
|
|
145
149
|
const session = this.#sessions.get(sessionId);
|
|
146
150
|
if (!session) return false;
|
|
147
151
|
session.cancelTTL();
|
|
@@ -151,7 +155,11 @@ class AutonomousCustomerServiceAgent extends EventEmitter {
|
|
|
151
155
|
}
|
|
152
156
|
const sessionData = session.toJSON(); // Copia o estado antes de deletar a sessão
|
|
153
157
|
this.#sessions.delete(sessionId);
|
|
154
|
-
|
|
158
|
+
|
|
159
|
+
if (eventTrigger) {
|
|
160
|
+
this.emit(AgentEvents.SESSION_CLEARED, { session: sessionData, reason, data });
|
|
161
|
+
}
|
|
162
|
+
|
|
155
163
|
return true;
|
|
156
164
|
}
|
|
157
165
|
|