@minded-ai/mindedjs 2.0.18-beta.8 → 2.0.18
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/dist/agent.js +17 -7
- package/dist/agent.js.map +1 -1
- package/dist/browserTask/executeBrowserTask.d.ts.map +1 -1
- package/dist/browserTask/executeBrowserTask.js +14 -1
- package/dist/browserTask/executeBrowserTask.js.map +1 -1
- package/dist/browserTask/localBrowserTask.d.ts +14 -1
- package/dist/browserTask/localBrowserTask.d.ts.map +1 -1
- package/dist/browserTask/localBrowserTask.js +32 -35
- package/dist/browserTask/localBrowserTask.js.map +1 -1
- package/dist/checkpointer/checkpointSaverFactory.js +17 -7
- package/dist/checkpointer/checkpointSaverFactory.js.map +1 -1
- package/dist/cli/index.js +17 -7
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/lambdaHandlerTemplate.d.ts.map +1 -1
- package/dist/cli/localOperatorSetup.js +17 -7
- package/dist/cli/localOperatorSetup.js.map +1 -1
- package/dist/edges/createDirectEdge.d.ts.map +1 -1
- package/dist/edges/createLogicalRouter.d.ts.map +1 -1
- package/dist/edges/createLogicalRouter.js +17 -7
- package/dist/edges/createLogicalRouter.js.map +1 -1
- package/dist/edges/createPromptRouter.d.ts.map +1 -1
- package/dist/edges/edgeFactory.d.ts.map +1 -1
- package/dist/index.js +17 -7
- package/dist/index.js.map +1 -1
- package/dist/interfaces/zendesk.js +17 -7
- package/dist/interfaces/zendesk.js.map +1 -1
- package/dist/internalTools/appActionRunnerTool.d.ts.map +1 -1
- package/dist/internalTools/appActionRunnerTool.js +17 -7
- package/dist/internalTools/appActionRunnerTool.js.map +1 -1
- package/dist/internalTools/documentExtraction/documentExtraction.js +17 -7
- package/dist/internalTools/documentExtraction/documentExtraction.js.map +1 -1
- package/dist/internalTools/libraryActionRunnerTool.d.ts.map +1 -1
- package/dist/internalTools/timer.js +17 -7
- package/dist/internalTools/timer.js.map +1 -1
- package/dist/internalTools/voice/escalateVoiceCall.d.ts.map +1 -1
- package/dist/internalTools/voice/escalateVoiceCall.js +17 -7
- package/dist/internalTools/voice/escalateVoiceCall.js.map +1 -1
- package/dist/internalTools/voice/retell.js +17 -7
- package/dist/internalTools/voice/retell.js.map +1 -1
- package/dist/internalTools/voice/sendPlaceholderMessage.js +17 -7
- package/dist/internalTools/voice/sendPlaceholderMessage.js.map +1 -1
- package/dist/interrupts/MindedInterruptSessionManager.js +17 -7
- package/dist/interrupts/MindedInterruptSessionManager.js.map +1 -1
- package/dist/interrupts/interruptSessionManagerFactory.js +17 -7
- package/dist/interrupts/interruptSessionManagerFactory.js.map +1 -1
- package/dist/llm/createLlmInstance.d.ts.map +1 -1
- package/dist/nodes/addAppToolNode.d.ts.map +1 -1
- package/dist/nodes/addBrowserTaskNode.d.ts.map +1 -1
- package/dist/nodes/addBrowserTaskRunNode.d.ts.map +1 -1
- package/dist/nodes/addHumanInTheLoopNode.d.ts.map +1 -1
- package/dist/nodes/addJumpToNode.d.ts.map +1 -1
- package/dist/nodes/addJunctionNode.d.ts.map +1 -1
- package/dist/nodes/addPromptNode.d.ts.map +1 -1
- package/dist/nodes/addRpaNode.d.ts.map +1 -1
- package/dist/nodes/addToolNode.d.ts.map +1 -1
- package/dist/nodes/addToolRunNode.d.ts.map +1 -1
- package/dist/nodes/addTriggerNode.d.ts.map +1 -1
- package/dist/nodes/compilePrompt.js +17 -7
- package/dist/nodes/compilePrompt.js.map +1 -1
- package/dist/nodes/nodeFactory.d.ts.map +1 -1
- package/dist/platform/mindedCheckpointSaver.js +17 -7
- package/dist/platform/mindedCheckpointSaver.js.map +1 -1
- package/dist/platform/mindedConnection.d.ts.map +1 -1
- package/dist/platform/mindedConnection.js +17 -7
- package/dist/platform/mindedConnection.js.map +1 -1
- package/dist/platform/piiGateway/gateway.js +17 -7
- package/dist/platform/piiGateway/gateway.js.map +1 -1
- package/dist/platform/utils/parseAttachments.d.ts.map +1 -1
- package/dist/platform/utils/tools.d.ts.map +1 -1
- package/dist/playbooks/playbooks.js +17 -7
- package/dist/playbooks/playbooks.js.map +1 -1
- package/dist/toolsLibrary/classifier.d.ts.map +1 -1
- package/dist/toolsLibrary/extraction.d.ts.map +1 -1
- package/dist/toolsLibrary/index.js +17 -7
- package/dist/toolsLibrary/index.js.map +1 -1
- package/dist/toolsLibrary/parseDocument.d.ts +3 -3
- package/dist/types/LangGraph.types.d.ts.map +1 -1
- package/dist/utils/agentUtils.js +17 -7
- package/dist/utils/agentUtils.js.map +1 -1
- package/dist/utils/history.d.ts.map +1 -1
- package/dist/utils/logger.d.ts +2 -1
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/wait.d.ts.map +1 -1
- package/dist/voice/voiceSession.js +17 -7
- package/dist/voice/voiceSession.js.map +1 -1
- package/package.json +1 -1
- package/src/browserTask/executeBrowserTask.ts +19 -2
- package/src/browserTask/localBrowserTask.ts +29 -28
- package/dist/browserTask/cdp.d.ts +0 -23
- package/dist/browserTask/cdp.d.ts.map +0 -1
- package/dist/browserTask/cdp.js +0 -162
- package/dist/browserTask/cdp.js.map +0 -1
- package/dist/guidelines/guidelinesManager.d.ts +0 -37
- package/dist/guidelines/guidelinesManager.d.ts.map +0 -1
- package/dist/guidelines/guidelinesManager.js +0 -172
- package/dist/guidelines/guidelinesManager.js.map +0 -1
- package/dist/internalTools/retell.d.ts +0 -12
- package/dist/internalTools/retell.d.ts.map +0 -1
- package/dist/internalTools/retell.js +0 -54
- package/dist/internalTools/retell.js.map +0 -1
- package/dist/internalTools/sendPlaceholderMessage.d.ts +0 -14
- package/dist/internalTools/sendPlaceholderMessage.d.ts.map +0 -1
- package/dist/internalTools/sendPlaceholderMessage.js +0 -61
- package/dist/internalTools/sendPlaceholderMessage.js.map +0 -1
- package/dist/platform/mindedChatOpenAI.d.ts +0 -5
- package/dist/platform/mindedChatOpenAI.d.ts.map +0 -1
- package/dist/platform/mindedChatOpenAI.js +0 -23
- package/dist/platform/mindedChatOpenAI.js.map +0 -1
- package/dist/utils/extractStateMemoryResponse.d.ts +0 -5
- package/dist/utils/extractStateMemoryResponse.d.ts.map +0 -1
- package/dist/utils/extractStateMemoryResponse.js +0 -91
- package/dist/utils/extractStateMemoryResponse.js.map +0 -1
- package/dist/utils/extractToolMemoryResponse.d.ts +0 -4
- package/dist/utils/extractToolMemoryResponse.d.ts.map +0 -1
- package/dist/utils/extractToolMemoryResponse.js +0 -16
- package/dist/utils/extractToolMemoryResponse.js.map +0 -1
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.retellCall = retellCall;
|
|
37
|
-
exports.retellGetCall = retellGetCall;
|
|
38
|
-
const mindedConnection = __importStar(require("../platform/mindedConnection"));
|
|
39
|
-
const mindedConnectionTypes_1 = require("../platform/mindedConnectionTypes");
|
|
40
|
-
async function retellCall({ sessionId, callName, callAgentId, vars = {}, }) {
|
|
41
|
-
return await mindedConnection.awaitEmit(mindedConnectionTypes_1.mindedConnectionSocketMessageType.RETELL_CALL, {
|
|
42
|
-
sessionId,
|
|
43
|
-
callName,
|
|
44
|
-
callAgentId,
|
|
45
|
-
vars,
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
async function retellGetCall({ sessionId, callId }) {
|
|
49
|
-
return await mindedConnection.awaitEmit(mindedConnectionTypes_1.mindedConnectionSocketMessageType.RETELL_GET_CALL, {
|
|
50
|
-
sessionId,
|
|
51
|
-
callId,
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=retell.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"retell.js","sourceRoot":"","sources":["../../src/internalTools/retell.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,gCAiBC;AAED,sCAKC;AA3BD,+EAAiE;AACjE,6EAAiI;AAE1H,KAAK,UAAU,UAAU,CAAC,EAC/B,SAAS,EACT,QAAQ,EACR,WAAW,EACX,IAAI,GAAG,EAAE,GAMV;IACC,OAAO,MAAM,gBAAgB,CAAC,SAAS,CAAC,yDAAiC,CAAC,WAAW,EAAE;QACrF,SAAS;QACT,QAAQ;QACR,WAAW;QACX,IAAI;KACL,CAAC,CAAC;AACL,CAAC;AAEM,KAAK,UAAU,aAAa,CAAC,EAAE,SAAS,EAAE,MAAM,EAAyC;IAC9F,OAAO,MAAM,gBAAgB,CAAC,SAAS,CAAC,yDAAiC,CAAC,eAAe,EAAE;QACzF,SAAS;QACT,MAAM;KACP,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Send a placeholder message to the dashboard voice session.
|
|
3
|
-
* This is typically used for voice sessions to provide immediate feedback to users.
|
|
4
|
-
*
|
|
5
|
-
* @param params - The parameters for sending the placeholder message
|
|
6
|
-
* @param params.sessionId - The session ID of the voice session
|
|
7
|
-
* @param params.message - The placeholder message to send
|
|
8
|
-
* @throws {Error} When the Minded connection is not established
|
|
9
|
-
*/
|
|
10
|
-
export declare function sendPlaceholderMessage(params: {
|
|
11
|
-
sessionId: string;
|
|
12
|
-
message: string;
|
|
13
|
-
}): Promise<void>;
|
|
14
|
-
//# sourceMappingURL=sendPlaceholderMessage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sendPlaceholderMessage.d.ts","sourceRoot":"","sources":["../../src/internalTools/sendPlaceholderMessage.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,wBAAsB,sBAAsB,CAAC,MAAM,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAc1G"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.sendPlaceholderMessage = sendPlaceholderMessage;
|
|
37
|
-
const mindedConnection = __importStar(require("../platform/mindedConnection"));
|
|
38
|
-
const mindedConnectionTypes_1 = require("../platform/mindedConnectionTypes");
|
|
39
|
-
/**
|
|
40
|
-
* Send a placeholder message to the dashboard voice session.
|
|
41
|
-
* This is typically used for voice sessions to provide immediate feedback to users.
|
|
42
|
-
*
|
|
43
|
-
* @param params - The parameters for sending the placeholder message
|
|
44
|
-
* @param params.sessionId - The session ID of the voice session
|
|
45
|
-
* @param params.message - The placeholder message to send
|
|
46
|
-
* @throws {Error} When the Minded connection is not established
|
|
47
|
-
*/
|
|
48
|
-
async function sendPlaceholderMessage(params) {
|
|
49
|
-
const { sessionId, message } = params;
|
|
50
|
-
if (!mindedConnection.isConnected()) {
|
|
51
|
-
throw new Error('Minded connection is not established when trying to send placeholder message');
|
|
52
|
-
}
|
|
53
|
-
const connection = mindedConnection;
|
|
54
|
-
connection.emit(mindedConnectionTypes_1.mindedConnectionSocketMessageType.VOICE_PLACEHOLDER_MESSAGES, {
|
|
55
|
-
sessionId,
|
|
56
|
-
message,
|
|
57
|
-
timestamp: Date.now(),
|
|
58
|
-
type: mindedConnectionTypes_1.mindedConnectionSocketMessageType.VOICE_PLACEHOLDER_MESSAGES,
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
//# sourceMappingURL=sendPlaceholderMessage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sendPlaceholderMessage.js","sourceRoot":"","sources":["../../src/internalTools/sendPlaceholderMessage.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,wDAcC;AA1BD,+EAAiE;AACjE,6EAAsF;AAEtF;;;;;;;;GAQG;AACI,KAAK,UAAU,sBAAsB,CAAC,MAA8C;IACzF,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IAEtC,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CAAC,8EAA8E,CAAC,CAAC;IAClG,CAAC;IAED,MAAM,UAAU,GAAG,gBAAgB,CAAC;IACpC,UAAU,CAAC,IAAI,CAAC,yDAAiC,CAAC,0BAA0B,EAAE;QAC5E,SAAS;QACT,OAAO;QACP,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;QACrB,IAAI,EAAE,yDAAiC,CAAC,0BAA0B;KACnE,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mindedChatOpenAI.d.ts","sourceRoot":"","sources":["../../src/platform/mindedChatOpenAI.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAGjE,qBAAa,gBAAiB,SAAQ,UAAU;gBAClC,MAAM,CAAC,EAAE,gBAAgB;CActC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MindedChatOpenAI = void 0;
|
|
4
|
-
const openai_1 = require("@langchain/openai");
|
|
5
|
-
const config_1 = require("./config");
|
|
6
|
-
class MindedChatOpenAI extends openai_1.ChatOpenAI {
|
|
7
|
-
constructor(fields) {
|
|
8
|
-
const { token, baseUrl } = (0, config_1.getConfig)();
|
|
9
|
-
const mindedBaseUrl = `${baseUrl}/sdk/llmGateway/chatOpenAI`;
|
|
10
|
-
if (!token) {
|
|
11
|
-
throw new Error('Minded token not found');
|
|
12
|
-
}
|
|
13
|
-
super({
|
|
14
|
-
...fields,
|
|
15
|
-
apiKey: token,
|
|
16
|
-
configuration: {
|
|
17
|
-
baseURL: mindedBaseUrl,
|
|
18
|
-
},
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
exports.MindedChatOpenAI = MindedChatOpenAI;
|
|
23
|
-
//# sourceMappingURL=mindedChatOpenAI.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mindedChatOpenAI.js","sourceRoot":"","sources":["../../src/platform/mindedChatOpenAI.ts"],"names":[],"mappings":";;;AAAA,8CAAiE;AACjE,qCAAqC;AAErC,MAAa,gBAAiB,SAAQ,mBAAU;IAC9C,YAAY,MAAyB;QACnC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,IAAA,kBAAS,GAAE,CAAC;QACvC,MAAM,aAAa,GAAG,GAAG,OAAO,4BAA4B,CAAC;QAC7D,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAC5C,CAAC;QACD,KAAK,CAAC;YACJ,GAAG,MAAM;YACT,MAAM,EAAE,KAAK;YACb,aAAa,EAAE;gBACb,OAAO,EAAE,aAAa;aACvB;SACF,CAAC,CAAC;IACL,CAAC;CACF;AAfD,4CAeC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { ToolMessage } from '@langchain/core/messages';
|
|
2
|
-
import { State } from '../types/LangGraph.types';
|
|
3
|
-
declare const extractToolStateResponse: (toolMessage: ToolMessage) => Partial<State>;
|
|
4
|
-
export default extractToolStateResponse;
|
|
5
|
-
//# sourceMappingURL=extractStateMemoryResponse.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extractStateMemoryResponse.d.ts","sourceRoot":"","sources":["../../src/utils/extractStateMemoryResponse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAA0C,MAAM,0BAA0B,CAAC;AAE5G,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAEjD,QAAA,MAAM,wBAAwB,GAAI,aAAa,WAAW,KAAG,OAAO,CAAC,KAAK,CAazE,CAAC;AA4EF,eAAe,wBAAwB,CAAC"}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const messages_1 = require("@langchain/core/messages");
|
|
4
|
-
const logger_1 = require("./logger");
|
|
5
|
-
const extractToolStateResponse = (toolMessage) => {
|
|
6
|
-
try {
|
|
7
|
-
const parsed = JSON.parse(toolMessage.content);
|
|
8
|
-
if (typeof parsed === 'object' && parsed !== null && 'state' in parsed) {
|
|
9
|
-
if (parsed.state.messages) {
|
|
10
|
-
parsed.state.messages = constructMessagesFromToolMessage(parsed.state.messages);
|
|
11
|
-
}
|
|
12
|
-
return parsed.state;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
catch (err) {
|
|
16
|
-
logger_1.logger.error({ message: 'Error parsing tool state response', err });
|
|
17
|
-
}
|
|
18
|
-
return {};
|
|
19
|
-
};
|
|
20
|
-
const constructMessagesFromToolMessage = (messages) => {
|
|
21
|
-
if (!Array.isArray(messages)) {
|
|
22
|
-
logger_1.logger.error({ msg: 'Expected messages to be an array', messages });
|
|
23
|
-
return [];
|
|
24
|
-
}
|
|
25
|
-
return messages
|
|
26
|
-
.map((messageObj) => {
|
|
27
|
-
try {
|
|
28
|
-
// Handle case where message is already a BaseMessage instance
|
|
29
|
-
if (messageObj instanceof messages_1.BaseMessage) {
|
|
30
|
-
return messageObj;
|
|
31
|
-
}
|
|
32
|
-
// Handle case where message is a plain object that needs reconstruction
|
|
33
|
-
const messageType = messageObj.id[2];
|
|
34
|
-
const content = messageObj.kwargs.content || '';
|
|
35
|
-
const id = messageObj.kwargs.id;
|
|
36
|
-
const additionalKwargs = messageObj.additional_kwargs || {};
|
|
37
|
-
switch (messageType) {
|
|
38
|
-
case 'AIMessage':
|
|
39
|
-
return new messages_1.AIMessage({
|
|
40
|
-
content,
|
|
41
|
-
id,
|
|
42
|
-
additional_kwargs: additionalKwargs,
|
|
43
|
-
tool_calls: messageObj.tool_calls || [],
|
|
44
|
-
invalid_tool_calls: messageObj.invalid_tool_calls || [],
|
|
45
|
-
});
|
|
46
|
-
case 'HumanMessage':
|
|
47
|
-
return new messages_1.HumanMessage({
|
|
48
|
-
content,
|
|
49
|
-
id,
|
|
50
|
-
additional_kwargs: additionalKwargs,
|
|
51
|
-
});
|
|
52
|
-
case 'SystemMessage':
|
|
53
|
-
return new messages_1.SystemMessage({
|
|
54
|
-
content,
|
|
55
|
-
id,
|
|
56
|
-
additional_kwargs: additionalKwargs,
|
|
57
|
-
});
|
|
58
|
-
case 'ToolMessage':
|
|
59
|
-
return new messages_1.ToolMessage({
|
|
60
|
-
content,
|
|
61
|
-
id,
|
|
62
|
-
additional_kwargs: additionalKwargs,
|
|
63
|
-
tool_call_id: messageObj.tool_call_id || '',
|
|
64
|
-
});
|
|
65
|
-
default:
|
|
66
|
-
// Default to HumanMessage for unknown types
|
|
67
|
-
logger_1.logger.warn({
|
|
68
|
-
msg: 'Unknown message type, defaulting to HumanMessage',
|
|
69
|
-
messageType,
|
|
70
|
-
messageObj,
|
|
71
|
-
});
|
|
72
|
-
return null;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
catch (err) {
|
|
76
|
-
logger_1.logger.error({
|
|
77
|
-
msg: 'Error reconstructing message',
|
|
78
|
-
err,
|
|
79
|
-
messageObj,
|
|
80
|
-
});
|
|
81
|
-
// Return a fallback HumanMessage in case of error
|
|
82
|
-
return new messages_1.HumanMessage({
|
|
83
|
-
content: messageObj.content || 'Error reconstructing message',
|
|
84
|
-
id: messageObj.id,
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
})
|
|
88
|
-
.filter(Boolean);
|
|
89
|
-
};
|
|
90
|
-
exports.default = extractToolStateResponse;
|
|
91
|
-
//# sourceMappingURL=extractStateMemoryResponse.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extractStateMemoryResponse.js","sourceRoot":"","sources":["../../src/utils/extractStateMemoryResponse.ts"],"names":[],"mappings":"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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extractToolMemoryResponse.d.ts","sourceRoot":"","sources":["../../src/utils/extractToolMemoryResponse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,QAAA,MAAM,yBAAyB,GAAI,MAAM,EAAE,aAAa,WAAW,KAAG,OAAO,CAAC,MAAM,CAUnF,CAAC;AAEF,eAAe,yBAAyB,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const extractToolMemoryResponse = (toolMessage) => {
|
|
4
|
-
try {
|
|
5
|
-
const parsed = JSON.parse(toolMessage.content);
|
|
6
|
-
if (typeof parsed === 'object' && parsed !== null && 'memory' in parsed) {
|
|
7
|
-
return parsed.memory;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
catch (error) {
|
|
11
|
-
console.error('Error parsing tool memory response', error);
|
|
12
|
-
}
|
|
13
|
-
return {};
|
|
14
|
-
};
|
|
15
|
-
exports.default = extractToolMemoryResponse;
|
|
16
|
-
//# sourceMappingURL=extractToolMemoryResponse.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extractToolMemoryResponse.js","sourceRoot":"","sources":["../../src/utils/extractToolMemoryResponse.ts"],"names":[],"mappings":";;AAEA,MAAM,yBAAyB,GAAG,CAAS,WAAwB,EAAmB,EAAE;IACtF,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,OAAiB,CAAC,CAAC;QACzD,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,IAAI,QAAQ,IAAI,MAAM,EAAE,CAAC;YACxE,OAAO,MAAM,CAAC,MAAM,CAAC;QACvB,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,oCAAoC,EAAE,KAAK,CAAC,CAAC;IAC7D,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAEF,kBAAe,yBAAyB,CAAC"}
|