@minded-ai/mindedjs 1.0.150 → 2.0.0-beta1
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.d.ts +2 -2
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +31 -53
- package/dist/agent.js.map +1 -1
- package/dist/cli/index.js +0 -0
- package/dist/edges/createLogicalRouter.d.ts.map +1 -1
- package/dist/edges/createLogicalRouter.js +4 -18
- package/dist/edges/createLogicalRouter.js.map +1 -1
- package/dist/events/AgentEvents.d.ts +5 -14
- package/dist/events/AgentEvents.d.ts.map +1 -1
- package/dist/guidelines/guidelinesManager.d.ts +37 -0
- package/dist/guidelines/guidelinesManager.d.ts.map +1 -0
- package/dist/guidelines/guidelinesManager.js +172 -0
- package/dist/guidelines/guidelinesManager.js.map +1 -0
- package/dist/internalTools/documentExtraction.d.ts +69 -0
- package/dist/internalTools/documentExtraction.d.ts.map +1 -0
- package/dist/internalTools/documentExtraction.js +65 -0
- package/dist/internalTools/documentExtraction.js.map +1 -0
- package/dist/internalTools/libraryActionRunnerTool.d.ts.map +1 -1
- package/dist/internalTools/libraryActionRunnerTool.js +0 -1
- package/dist/internalTools/libraryActionRunnerTool.js.map +1 -1
- package/dist/internalTools/managedDocumentParser/managedDocumentParser.d.ts +10 -0
- package/dist/internalTools/managedDocumentParser/managedDocumentParser.d.ts.map +1 -0
- package/dist/internalTools/managedDocumentParser/managedDocumentParser.js +80 -0
- package/dist/internalTools/managedDocumentParser/managedDocumentParser.js.map +1 -0
- package/dist/internalTools/retell.d.ts +12 -0
- package/dist/internalTools/retell.d.ts.map +1 -0
- package/dist/internalTools/retell.js +44 -0
- package/dist/internalTools/retell.js.map +1 -0
- package/dist/internalTools/sendPlaceholderMessage.d.ts +14 -0
- package/dist/internalTools/sendPlaceholderMessage.d.ts.map +1 -0
- package/dist/internalTools/sendPlaceholderMessage.js +51 -0
- package/dist/internalTools/sendPlaceholderMessage.js.map +1 -0
- package/dist/interrupts/BaseInterruptSessionManager.d.ts +2 -2
- package/dist/interrupts/BaseInterruptSessionManager.d.ts.map +1 -1
- package/dist/interrupts/BaseInterruptSessionManager.js +1 -7
- package/dist/interrupts/BaseInterruptSessionManager.js.map +1 -1
- package/dist/nodes/addAppToolNode.d.ts.map +1 -1
- package/dist/nodes/addAppToolNode.js +24 -18
- package/dist/nodes/addAppToolNode.js.map +1 -1
- package/dist/nodes/addBrowserTaskNode.d.ts.map +1 -1
- package/dist/nodes/addBrowserTaskNode.js +30 -27
- package/dist/nodes/addBrowserTaskNode.js.map +1 -1
- package/dist/nodes/addBrowserTaskRunNode.d.ts.map +1 -1
- package/dist/nodes/addBrowserTaskRunNode.js +18 -20
- package/dist/nodes/addBrowserTaskRunNode.js.map +1 -1
- package/dist/nodes/addJumpToNode.d.ts.map +1 -1
- package/dist/nodes/addJumpToNode.js +8 -9
- package/dist/nodes/addJumpToNode.js.map +1 -1
- package/dist/nodes/addJunctionNode.d.ts.map +1 -1
- package/dist/nodes/addJunctionNode.js +8 -9
- package/dist/nodes/addJunctionNode.js.map +1 -1
- package/dist/nodes/addPromptNode.d.ts.map +1 -1
- package/dist/nodes/addPromptNode.js +40 -58
- package/dist/nodes/addPromptNode.js.map +1 -1
- package/dist/nodes/addToolNode.d.ts.map +1 -1
- package/dist/nodes/addToolNode.js +33 -20
- package/dist/nodes/addToolNode.js.map +1 -1
- package/dist/nodes/addToolRunNode.d.ts.map +1 -1
- package/dist/nodes/addToolRunNode.js +15 -21
- package/dist/nodes/addToolRunNode.js.map +1 -1
- package/dist/nodes/addTriggerNode.js +9 -11
- package/dist/nodes/addTriggerNode.js.map +1 -1
- package/dist/nodes/compilePrompt.d.ts.map +1 -1
- package/dist/nodes/compilePrompt.js +2 -0
- package/dist/nodes/compilePrompt.js.map +1 -1
- package/dist/pii-gateway/gateway.d.ts +17 -0
- package/dist/pii-gateway/gateway.d.ts.map +1 -0
- package/dist/pii-gateway/gateway.js +77 -0
- package/dist/pii-gateway/gateway.js.map +1 -0
- package/dist/pii-gateway/index.d.ts +4 -0
- package/dist/pii-gateway/index.d.ts.map +1 -0
- package/dist/pii-gateway/index.js +14 -0
- package/dist/pii-gateway/index.js.map +1 -0
- package/dist/pii-gateway/proxy.d.ts +80 -0
- package/dist/pii-gateway/proxy.d.ts.map +1 -0
- package/dist/pii-gateway/proxy.js +106 -0
- package/dist/pii-gateway/proxy.js.map +1 -0
- package/dist/pii-gateway/types.d.ts +27 -0
- package/dist/pii-gateway/types.d.ts.map +1 -0
- package/dist/pii-gateway/types.js +3 -0
- package/dist/pii-gateway/types.js.map +1 -0
- package/dist/platform/mindedChatOpenAI.d.ts +5 -0
- package/dist/platform/mindedChatOpenAI.d.ts.map +1 -0
- package/dist/platform/mindedChatOpenAI.js +23 -0
- package/dist/platform/mindedChatOpenAI.js.map +1 -0
- package/dist/platform/mindedCheckpointSaver.js.map +1 -1
- package/dist/platform/mindedUtils.d.ts +1 -0
- package/dist/platform/mindedUtils.d.ts.map +1 -0
- package/dist/platform/mindedUtils.js +2 -0
- package/dist/platform/mindedUtils.js.map +1 -0
- package/dist/platform/parallelAzureChatOpenAI.d.ts +39 -0
- package/dist/platform/parallelAzureChatOpenAI.d.ts.map +1 -0
- package/dist/platform/parallelAzureChatOpenAI.js +114 -0
- package/dist/platform/parallelAzureChatOpenAI.js.map +1 -0
- package/dist/platform/parallelChatOpenAI.d.ts +38 -0
- package/dist/platform/parallelChatOpenAI.d.ts.map +1 -0
- package/dist/platform/parallelChatOpenAI.js +111 -0
- package/dist/platform/parallelChatOpenAI.js.map +1 -0
- package/dist/platform/parallelMindedChatOpenAI.d.ts +39 -0
- package/dist/platform/parallelMindedChatOpenAI.d.ts.map +1 -0
- package/dist/platform/parallelMindedChatOpenAI.js +111 -0
- package/dist/platform/parallelMindedChatOpenAI.js.map +1 -0
- package/dist/platform/piiGateway/proxy.d.ts +20 -0
- package/dist/platform/piiGateway/proxy.d.ts.map +1 -0
- package/dist/platform/piiGateway/proxy.js +24 -0
- package/dist/platform/piiGateway/proxy.js.map +1 -0
- package/dist/platform/toolExecutor.d.ts.map +1 -1
- package/dist/platform/toolExecutor.js +4 -20
- package/dist/platform/toolExecutor.js.map +1 -1
- package/dist/playbooks/playbooks.d.ts +1 -1
- package/dist/playbooks/playbooks.d.ts.map +1 -1
- package/dist/playbooks/playbooks.js +1 -1
- package/dist/playbooks/playbooks.js.map +1 -1
- package/dist/toolsLibrary/classifier.d.ts.map +1 -1
- package/dist/toolsLibrary/classifier.js +5 -9
- package/dist/toolsLibrary/classifier.js.map +1 -1
- package/dist/toolsLibrary/extraction.d.ts.map +1 -1
- package/dist/toolsLibrary/extraction.js +5 -9
- package/dist/toolsLibrary/extraction.js.map +1 -1
- package/dist/toolsLibrary/parseDocument.d.ts.map +1 -1
- package/dist/toolsLibrary/parseDocument.js +6 -14
- package/dist/toolsLibrary/parseDocument.js.map +1 -1
- package/dist/types/Agent.d.ts +2 -0
- package/dist/types/Agent.d.ts.map +1 -0
- package/dist/types/Agent.js +18 -0
- package/dist/types/Agent.js.map +1 -0
- package/dist/types/Agent.types.d.ts +1 -1
- package/dist/types/Agent.types.d.ts.map +1 -1
- package/dist/types/Flows.d.ts +2 -0
- package/dist/types/Flows.d.ts.map +1 -0
- package/dist/types/Flows.js +18 -0
- package/dist/types/Flows.js.map +1 -0
- package/dist/types/LLM.d.ts +2 -0
- package/dist/types/LLM.d.ts.map +1 -0
- package/dist/types/LLM.js +18 -0
- package/dist/types/LLM.js.map +1 -0
- package/dist/types/LangGraph.d.ts +2 -0
- package/dist/types/LangGraph.d.ts.map +1 -0
- package/dist/types/LangGraph.js +18 -0
- package/dist/types/LangGraph.js.map +1 -0
- package/dist/types/LangGraph.types.d.ts.map +1 -1
- package/dist/types/LangGraph.types.js +30 -42
- package/dist/types/LangGraph.types.js.map +1 -1
- package/dist/types/Platform.d.ts +2 -0
- package/dist/types/Platform.d.ts.map +1 -0
- package/dist/types/Platform.js +18 -0
- package/dist/types/Platform.js.map +1 -0
- package/dist/types/Tools.d.ts +2 -0
- package/dist/types/Tools.d.ts.map +1 -0
- package/dist/types/Tools.js +18 -0
- package/dist/types/Tools.js.map +1 -0
- package/dist/types/Tools.types.d.ts +2 -7
- package/dist/types/Tools.types.d.ts.map +1 -1
- package/dist/types/Triggers.d.ts +2 -0
- package/dist/types/Triggers.d.ts.map +1 -0
- package/dist/types/Triggers.js +18 -0
- package/dist/types/Triggers.js.map +1 -0
- package/dist/types/Triggers.types.d.ts +25 -0
- package/dist/types/Triggers.types.d.ts.map +1 -0
- package/dist/types/Triggers.types.js +3 -0
- package/dist/types/Triggers.types.js.map +1 -0
- package/dist/types/Voice.d.ts +2 -0
- package/dist/types/Voice.d.ts.map +1 -0
- package/dist/types/Voice.js +18 -0
- package/dist/types/Voice.js.map +1 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +25 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/LogicalConditionDebugger.d.ts +57 -0
- package/dist/utils/LogicalConditionDebugger.d.ts.map +1 -0
- package/dist/utils/LogicalConditionDebugger.js +143 -0
- package/dist/utils/LogicalConditionDebugger.js.map +1 -0
- package/dist/utils/documentProcessor.d.ts +87 -0
- package/dist/utils/documentProcessor.d.ts.map +1 -0
- package/dist/utils/documentProcessor.js +726 -0
- package/dist/utils/documentProcessor.js.map +1 -0
- package/dist/utils/extractStateMemoryResponse.d.ts +0 -4
- package/dist/utils/extractStateMemoryResponse.d.ts.map +1 -1
- package/dist/utils/extractStateMemoryResponse.js +87 -89
- package/dist/utils/extractStateMemoryResponse.js.map +1 -1
- package/dist/utils/extractToolGuidelineParams.d.ts +4 -0
- package/dist/utils/extractToolGuidelineParams.d.ts.map +1 -0
- package/dist/utils/extractToolGuidelineParams.js +20 -0
- package/dist/utils/extractToolGuidelineParams.js.map +1 -0
- package/dist/utils/extractToolMemoryResponse.d.ts +4 -0
- package/dist/utils/extractToolMemoryResponse.d.ts.map +1 -0
- package/dist/utils/extractToolMemoryResponse.js +16 -0
- package/dist/utils/extractToolMemoryResponse.js.map +1 -0
- package/dist/utils/parseAttachments.d.ts +14 -0
- package/dist/utils/parseAttachments.d.ts.map +1 -0
- package/dist/utils/parseAttachments.js +54 -0
- package/dist/utils/parseAttachments.js.map +1 -0
- package/docs/sdk/agent-api.md +1 -1
- package/package.json +1 -1
- package/src/agent.ts +35 -61
- package/src/edges/createLogicalRouter.ts +4 -19
- package/src/events/AgentEvents.ts +5 -14
- package/src/internalTools/libraryActionRunnerTool.ts +0 -1
- package/src/interrupts/BaseInterruptSessionManager.ts +3 -9
- package/src/nodes/addAppToolNode.ts +19 -11
- package/src/nodes/addBrowserTaskNode.ts +22 -16
- package/src/nodes/addBrowserTaskRunNode.ts +10 -9
- package/src/nodes/addJumpToNode.ts +5 -4
- package/src/nodes/addJunctionNode.ts +5 -4
- package/src/nodes/addPromptNode.ts +39 -47
- package/src/nodes/addToolNode.ts +34 -20
- package/src/nodes/addToolRunNode.ts +15 -15
- package/src/nodes/addTriggerNode.ts +5 -5
- package/src/nodes/compilePrompt.ts +3 -0
- package/src/platform/mindedCheckpointSaver.ts +13 -13
- package/src/platform/toolExecutor.ts +4 -20
- package/src/playbooks/playbooks.ts +2 -2
- package/src/toolsLibrary/classifier.ts +6 -9
- package/src/toolsLibrary/extraction.ts +6 -9
- package/src/toolsLibrary/parseDocument.ts +7 -14
- package/src/types/Agent.types.ts +1 -1
- package/src/types/LangGraph.types.ts +30 -41
- package/src/types/Tools.types.ts +2 -7
- package/src/utils/extractStateMemoryResponse.ts +0 -94
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Platform.d.ts","sourceRoot":"","sources":["../../src/types/Platform.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Platform.types"), exports);
|
|
18
|
+
//# sourceMappingURL=Platform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Platform.js","sourceRoot":"","sources":["../../src/types/Platform.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tools.d.ts","sourceRoot":"","sources":["../../src/types/Tools.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Tools.types"), exports);
|
|
18
|
+
//# sourceMappingURL=Tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tools.js","sourceRoot":"","sources":["../../src/types/Tools.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B"}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { Agent } from '../';
|
|
3
3
|
import { State } from './LangGraph.types';
|
|
4
|
-
type
|
|
5
|
-
memory?: Partial<Memory>;
|
|
6
|
-
};
|
|
7
|
-
export type ToolReturnType<Memory = any> = {
|
|
8
|
-
state?: StateUpdate<Memory>;
|
|
4
|
+
export type ToolReturnType = {
|
|
9
5
|
result?: any;
|
|
10
6
|
} | void;
|
|
11
7
|
export interface Tool<Input extends z.ZodSchema, Memory = any> {
|
|
@@ -14,7 +10,7 @@ export interface Tool<Input extends z.ZodSchema, Memory = any> {
|
|
|
14
10
|
input: Input;
|
|
15
11
|
isGlobal?: boolean;
|
|
16
12
|
allowExecutionRequests?: boolean;
|
|
17
|
-
execute: (input: ToolExecuteInput<Input, Memory>) => Promise<ToolReturnType
|
|
13
|
+
execute: (input: ToolExecuteInput<Input, Memory>) => Promise<ToolReturnType>;
|
|
18
14
|
}
|
|
19
15
|
export interface ToolExecuteInput<Input extends z.ZodSchema, Memory = any> {
|
|
20
16
|
input: z.infer<Input>;
|
|
@@ -26,5 +22,4 @@ export interface AppActionRunnerInput {
|
|
|
26
22
|
actionName: string;
|
|
27
23
|
actionInput: object;
|
|
28
24
|
}
|
|
29
|
-
export {};
|
|
30
25
|
//# sourceMappingURL=Tools.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tools.types.d.ts","sourceRoot":"","sources":["../../src/types/Tools.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,CAAC;AAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAG1C,
|
|
1
|
+
{"version":3,"file":"Tools.types.d.ts","sourceRoot":"","sources":["../../src/types/Tools.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,CAAC;AAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAG1C,MAAM,MAAM,cAAc,GAAG;IAAE,MAAM,CAAC,EAAE,GAAG,CAAA;CAAE,GAAG,IAAI,CAAC;AAErD,MAAM,WAAW,IAAI,CAAC,KAAK,SAAS,CAAC,CAAC,SAAS,EAAE,MAAM,GAAG,GAAG;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,OAAO,EAAE,CAAC,KAAK,EAAE,gBAAgB,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;CAC9E;AAED,MAAM,WAAW,gBAAgB,CAAC,KAAK,SAAS,CAAC,CAAC,SAAS,EAAE,MAAM,GAAG,GAAG;IACvE,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACtB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACrB,KAAK,EAAE,KAAK,CAAC;CACd;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Triggers.d.ts","sourceRoot":"","sources":["../../src/types/Triggers.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Triggers.types"), exports);
|
|
18
|
+
//# sourceMappingURL=Triggers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Triggers.js","sourceRoot":"","sources":["../../src/types/Triggers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { KnownTriggerNames } from './Flows.types';
|
|
2
|
+
export interface TriggerEvent {
|
|
3
|
+
/** The payload/data associated with the trigger */
|
|
4
|
+
triggerBody: any;
|
|
5
|
+
/** The name/type of the trigger being invoked */
|
|
6
|
+
triggerName: string;
|
|
7
|
+
/** Optional name of the application triggering the agent in case of an app trigger */
|
|
8
|
+
appName?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface MindedPlatformTriggerEvent extends TriggerEvent {
|
|
11
|
+
/** The payload/data associated with the trigger */
|
|
12
|
+
triggerBody: {
|
|
13
|
+
content: string;
|
|
14
|
+
sessionId: string;
|
|
15
|
+
attachments: MidnedPlatformAttachment[];
|
|
16
|
+
};
|
|
17
|
+
/** The name/type of the trigger being invoked */
|
|
18
|
+
triggerName: KnownTriggerNames.DASHBOARD_MESSAGE;
|
|
19
|
+
}
|
|
20
|
+
export interface MidnedPlatformAttachment {
|
|
21
|
+
type: string;
|
|
22
|
+
data: any;
|
|
23
|
+
name: string;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=Triggers.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Triggers.types.d.ts","sourceRoot":"","sources":["../../src/types/Triggers.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,MAAM,WAAW,YAAY;IAC3B,mDAAmD;IACnD,WAAW,EAAE,GAAG,CAAC;IACjB,iDAAiD;IACjD,WAAW,EAAE,MAAM,CAAC;IACpB,sFAAsF;IACtF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,0BAA2B,SAAQ,YAAY;IAC9D,mDAAmD;IACnD,WAAW,EAAE;QACX,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC;QAClB,WAAW,EAAE,wBAAwB,EAAE,CAAC;KACzC,CAAC;IACF,iDAAiD;IACjD,WAAW,EAAE,iBAAiB,CAAC,iBAAiB,CAAC;CAClD;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,GAAG,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;CACd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Triggers.types.js","sourceRoot":"","sources":["../../src/types/Triggers.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Voice.d.ts","sourceRoot":"","sources":["../../src/types/Voice.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Voice.types"), exports);
|
|
18
|
+
//# sourceMappingURL=Voice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Voice.js","sourceRoot":"","sources":["../../src/types/Voice.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Agent"), exports);
|
|
18
|
+
__exportStar(require("./Tools"), exports);
|
|
19
|
+
__exportStar(require("./Flows"), exports);
|
|
20
|
+
__exportStar(require("./Triggers"), exports);
|
|
21
|
+
__exportStar(require("./LLM"), exports);
|
|
22
|
+
__exportStar(require("./Voice"), exports);
|
|
23
|
+
__exportStar(require("./Platform"), exports);
|
|
24
|
+
__exportStar(require("./LangGraph"), exports);
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,0CAAwB;AACxB,0CAAwB;AACxB,6CAA2B;AAC3B,wCAAsB;AACtB,0CAAwB;AACxB,6CAA2B;AAC3B,8CAA4B"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { LogicalConditionEdge } from '../types/Flows.types';
|
|
2
|
+
import { stateAnnotation } from '../types/LangGraph.types';
|
|
3
|
+
export interface ConditionDebugInfo {
|
|
4
|
+
edge: LogicalConditionEdge;
|
|
5
|
+
state: typeof stateAnnotation.State;
|
|
6
|
+
condition: string;
|
|
7
|
+
result?: boolean;
|
|
8
|
+
error?: Error;
|
|
9
|
+
executionTimeMs?: number;
|
|
10
|
+
}
|
|
11
|
+
export type ConditionDebugHook = (info: ConditionDebugInfo) => void | Promise<void>;
|
|
12
|
+
export declare class LogicalConditionDebugger {
|
|
13
|
+
private static instance;
|
|
14
|
+
private debugHooks;
|
|
15
|
+
private isDebugMode;
|
|
16
|
+
private constructor();
|
|
17
|
+
static getInstance(): LogicalConditionDebugger;
|
|
18
|
+
/**
|
|
19
|
+
* Register a debug hook that will be called before condition evaluation
|
|
20
|
+
* This allows users to set breakpoints in their code
|
|
21
|
+
*/
|
|
22
|
+
registerDebugHook(hook: ConditionDebugHook): void;
|
|
23
|
+
/**
|
|
24
|
+
* Clear all registered debug hooks
|
|
25
|
+
*/
|
|
26
|
+
clearDebugHooks(): void;
|
|
27
|
+
/**
|
|
28
|
+
* Log condition evaluation start
|
|
29
|
+
*/
|
|
30
|
+
logConditionStart(edge: LogicalConditionEdge, state: typeof stateAnnotation.State): void;
|
|
31
|
+
/**
|
|
32
|
+
* Log condition evaluation result
|
|
33
|
+
*/
|
|
34
|
+
logConditionResult(edge: LogicalConditionEdge, result: boolean, executionTimeMs: number, state: typeof stateAnnotation.State): void;
|
|
35
|
+
/**
|
|
36
|
+
* Log condition evaluation error
|
|
37
|
+
*/
|
|
38
|
+
logConditionError(edge: LogicalConditionEdge, error: Error, state: typeof stateAnnotation.State): void;
|
|
39
|
+
/**
|
|
40
|
+
* Call all registered debug hooks
|
|
41
|
+
*/
|
|
42
|
+
callDebugHooks(info: ConditionDebugInfo): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Log a summary of all conditions evaluated
|
|
45
|
+
*/
|
|
46
|
+
logConditionSummary(evaluatedConditions: Array<{
|
|
47
|
+
edge: LogicalConditionEdge;
|
|
48
|
+
result: boolean;
|
|
49
|
+
timeMs: number;
|
|
50
|
+
}>): void;
|
|
51
|
+
/**
|
|
52
|
+
* Check if debug mode is enabled
|
|
53
|
+
*/
|
|
54
|
+
isDebugEnabled(): boolean;
|
|
55
|
+
}
|
|
56
|
+
export declare const conditionDebugger: LogicalConditionDebugger;
|
|
57
|
+
//# sourceMappingURL=LogicalConditionDebugger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LogicalConditionDebugger.d.ts","sourceRoot":"","sources":["../../src/utils/LogicalConditionDebugger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,oBAAoB,CAAC;IAC3B,KAAK,EAAE,OAAO,eAAe,CAAC,KAAK,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,MAAM,kBAAkB,GAAG,CAAC,IAAI,EAAE,kBAAkB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAEpF,qBAAa,wBAAwB;IACnC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA2B;IAClD,OAAO,CAAC,UAAU,CAA4B;IAC9C,OAAO,CAAC,WAAW,CAAU;IAE7B,OAAO;IAIP,MAAM,CAAC,WAAW,IAAI,wBAAwB;IAO9C;;;OAGG;IACH,iBAAiB,CAAC,IAAI,EAAE,kBAAkB,GAAG,IAAI;IAQjD;;OAEG;IACH,eAAe,IAAI,IAAI;IAIvB;;OAEG;IACH,iBAAiB,CAAC,IAAI,EAAE,oBAAoB,EAAE,KAAK,EAAE,OAAO,eAAe,CAAC,KAAK,GAAG,IAAI;IAkBxF;;OAEG;IACH,kBAAkB,CAAC,IAAI,EAAE,oBAAoB,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,eAAe,CAAC,KAAK,GAAG,IAAI;IAiBnI;;OAEG;IACH,iBAAiB,CAAC,IAAI,EAAE,oBAAoB,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,eAAe,CAAC,KAAK,GAAG,IAAI;IAoBtG;;OAEG;IACG,cAAc,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAe7D;;OAEG;IACH,mBAAmB,CAAC,mBAAmB,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,oBAAoB,CAAC;QAAC,MAAM,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,IAAI;IAiBtH;;OAEG;IACH,cAAc,IAAI,OAAO;CAG1B;AAGD,eAAO,MAAM,iBAAiB,0BAAyC,CAAC"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.conditionDebugger = exports.LogicalConditionDebugger = void 0;
|
|
4
|
+
const logger_1 = require("./logger");
|
|
5
|
+
class LogicalConditionDebugger {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.debugHooks = [];
|
|
8
|
+
this.isDebugMode = process.env.LOG_LEVEL === 'debug';
|
|
9
|
+
}
|
|
10
|
+
static getInstance() {
|
|
11
|
+
if (!LogicalConditionDebugger.instance) {
|
|
12
|
+
LogicalConditionDebugger.instance = new LogicalConditionDebugger();
|
|
13
|
+
}
|
|
14
|
+
return LogicalConditionDebugger.instance;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Register a debug hook that will be called before condition evaluation
|
|
18
|
+
* This allows users to set breakpoints in their code
|
|
19
|
+
*/
|
|
20
|
+
registerDebugHook(hook) {
|
|
21
|
+
this.debugHooks.push(hook);
|
|
22
|
+
logger_1.logger.debug({
|
|
23
|
+
msg: '[LogicalConditionDebugger] Debug hook registered',
|
|
24
|
+
totalHooks: this.debugHooks.length,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Clear all registered debug hooks
|
|
29
|
+
*/
|
|
30
|
+
clearDebugHooks() {
|
|
31
|
+
this.debugHooks = [];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Log condition evaluation start
|
|
35
|
+
*/
|
|
36
|
+
logConditionStart(edge, state) {
|
|
37
|
+
var _a;
|
|
38
|
+
if (!this.isDebugMode)
|
|
39
|
+
return;
|
|
40
|
+
logger_1.logger.debug({
|
|
41
|
+
msg: '[LogicalCondition] Evaluating condition',
|
|
42
|
+
edge: {
|
|
43
|
+
source: edge.source,
|
|
44
|
+
target: edge.target,
|
|
45
|
+
condition: edge.condition,
|
|
46
|
+
},
|
|
47
|
+
state: {
|
|
48
|
+
memoryKeys: Object.keys(state.memory || {}),
|
|
49
|
+
messageCount: ((_a = state.messages) === null || _a === void 0 ? void 0 : _a.length) || 0,
|
|
50
|
+
hasGoto: !!state.goto,
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Log condition evaluation result
|
|
56
|
+
*/
|
|
57
|
+
logConditionResult(edge, result, executionTimeMs, state) {
|
|
58
|
+
if (!this.isDebugMode)
|
|
59
|
+
return;
|
|
60
|
+
logger_1.logger.debug({
|
|
61
|
+
msg: '[LogicalCondition] Condition evaluated',
|
|
62
|
+
edge: {
|
|
63
|
+
source: edge.source,
|
|
64
|
+
target: edge.target,
|
|
65
|
+
condition: edge.condition,
|
|
66
|
+
},
|
|
67
|
+
result,
|
|
68
|
+
executionTimeMs,
|
|
69
|
+
willTransition: result,
|
|
70
|
+
nextNode: result ? edge.target : null,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Log condition evaluation error
|
|
75
|
+
*/
|
|
76
|
+
logConditionError(edge, error, state) {
|
|
77
|
+
var _a;
|
|
78
|
+
// Always log errors, not just in debug mode
|
|
79
|
+
logger_1.logger.error({
|
|
80
|
+
msg: '[LogicalCondition] Error evaluating condition',
|
|
81
|
+
edge: {
|
|
82
|
+
source: edge.source,
|
|
83
|
+
target: edge.target,
|
|
84
|
+
condition: edge.condition,
|
|
85
|
+
},
|
|
86
|
+
error: error.message,
|
|
87
|
+
stack: this.isDebugMode ? error.stack : undefined,
|
|
88
|
+
state: this.isDebugMode
|
|
89
|
+
? {
|
|
90
|
+
memorySnapshot: JSON.stringify(state.memory).substring(0, 200) + '...',
|
|
91
|
+
messageCount: ((_a = state.messages) === null || _a === void 0 ? void 0 : _a.length) || 0,
|
|
92
|
+
}
|
|
93
|
+
: undefined,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Call all registered debug hooks
|
|
98
|
+
*/
|
|
99
|
+
async callDebugHooks(info) {
|
|
100
|
+
if (!this.isDebugMode || this.debugHooks.length === 0)
|
|
101
|
+
return;
|
|
102
|
+
for (const hook of this.debugHooks) {
|
|
103
|
+
try {
|
|
104
|
+
await hook(info);
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
logger_1.logger.warn({
|
|
108
|
+
msg: '[LogicalConditionDebugger] Debug hook threw error',
|
|
109
|
+
error: error instanceof Error ? error.message : String(error),
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Log a summary of all conditions evaluated
|
|
116
|
+
*/
|
|
117
|
+
logConditionSummary(evaluatedConditions) {
|
|
118
|
+
if (!this.isDebugMode || evaluatedConditions.length === 0)
|
|
119
|
+
return;
|
|
120
|
+
logger_1.logger.debug({
|
|
121
|
+
msg: '[LogicalCondition] Evaluation summary',
|
|
122
|
+
totalConditions: evaluatedConditions.length,
|
|
123
|
+
conditions: evaluatedConditions.map(({ edge, result, timeMs }) => ({
|
|
124
|
+
condition: edge.condition,
|
|
125
|
+
source: edge.source,
|
|
126
|
+
target: edge.target,
|
|
127
|
+
result,
|
|
128
|
+
timeMs,
|
|
129
|
+
})),
|
|
130
|
+
totalTimeMs: evaluatedConditions.reduce((sum, c) => sum + c.timeMs, 0),
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Check if debug mode is enabled
|
|
135
|
+
*/
|
|
136
|
+
isDebugEnabled() {
|
|
137
|
+
return this.isDebugMode;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
exports.LogicalConditionDebugger = LogicalConditionDebugger;
|
|
141
|
+
// Export singleton instance
|
|
142
|
+
exports.conditionDebugger = LogicalConditionDebugger.getInstance();
|
|
143
|
+
//# sourceMappingURL=LogicalConditionDebugger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LogicalConditionDebugger.js","sourceRoot":"","sources":["../../src/utils/LogicalConditionDebugger.ts"],"names":[],"mappings":";;;AAAA,qCAAkC;AAelC,MAAa,wBAAwB;IAKnC;QAHQ,eAAU,GAAyB,EAAE,CAAC;QAI5C,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,KAAK,OAAO,CAAC;IACvD,CAAC;IAED,MAAM,CAAC,WAAW;QAChB,IAAI,CAAC,wBAAwB,CAAC,QAAQ,EAAE,CAAC;YACvC,wBAAwB,CAAC,QAAQ,GAAG,IAAI,wBAAwB,EAAE,CAAC;QACrE,CAAC;QACD,OAAO,wBAAwB,CAAC,QAAQ,CAAC;IAC3C,C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K,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;iBAC9D,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC;IAED;;OAEG;IACH,mBAAmB,CAAC,mBAA2F;QAC7G,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,mBAAmB,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO;QAElE,eAAM,CAAC,KAAK,CAAC;YACX,GAAG,EAAE,uCAAuC;YAC5C,eAAe,EAAE,mBAAmB,CAAC,MAAM;YAC3C,UAAU,EAAE,mBAAmB,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;gBACjE,SAAS,EAAE,IAAI,CAAC,SAAS;gBACzB,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,MAAM;gBACN,MAAM;aACP,CAAC,CAAC;YACH,WAAW,EAAE,mBAAmB,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;SACvE,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,cAAc;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;CACF;AA/ID,4DA+IC;AAED,4BAA4B;AACf,QAAA,iBAAiB,GAAG,wBAAwB,CAAC,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { ZodSchema, ZodTypeAny } from 'zod';
|
|
2
|
+
import { BaseLanguageModel } from '@langchain/core/language_models/base';
|
|
3
|
+
export interface DocumentProcessorConfig {
|
|
4
|
+
llamaCloudApiKey?: string;
|
|
5
|
+
useBase64?: boolean;
|
|
6
|
+
maxImageWidth?: number;
|
|
7
|
+
imageQuality?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface DocumentExtractionOptions {
|
|
10
|
+
documentPath?: string;
|
|
11
|
+
documentContent?: Buffer | string;
|
|
12
|
+
documentUrl?: string;
|
|
13
|
+
schema?: ZodSchema<any> | ZodTypeAny;
|
|
14
|
+
llmConfig?: {
|
|
15
|
+
model?: string;
|
|
16
|
+
temperature?: number;
|
|
17
|
+
};
|
|
18
|
+
systemPrompt?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface DocumentProcessingResult<T = any> {
|
|
21
|
+
data: T;
|
|
22
|
+
metadata: {
|
|
23
|
+
fileSize?: number;
|
|
24
|
+
fileType: string;
|
|
25
|
+
processingTime: number;
|
|
26
|
+
contentLength: number;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Generic document processor that can extract structured data from various document types
|
|
31
|
+
* including images, PDFs, Word documents, spreadsheets, and more.
|
|
32
|
+
*/
|
|
33
|
+
export declare class DocumentProcessor {
|
|
34
|
+
private config;
|
|
35
|
+
private llm;
|
|
36
|
+
private llamaCloudApiKey;
|
|
37
|
+
constructor(config?: DocumentProcessorConfig, llm?: BaseLanguageModel);
|
|
38
|
+
/**
|
|
39
|
+
* Parse document using LlamaCloud REST API
|
|
40
|
+
*/
|
|
41
|
+
private parseWithLlamaCloud;
|
|
42
|
+
/**
|
|
43
|
+
* Get MIME type for file extension
|
|
44
|
+
*/
|
|
45
|
+
private getMimeType;
|
|
46
|
+
/**
|
|
47
|
+
* Extract data from a document - either structured data using AI or raw text
|
|
48
|
+
*/
|
|
49
|
+
extractFromDocument<T = string>(options: DocumentExtractionOptions): Promise<DocumentProcessingResult<T>>;
|
|
50
|
+
/**
|
|
51
|
+
* Get document content from various sources
|
|
52
|
+
*/
|
|
53
|
+
private getDocumentContent;
|
|
54
|
+
/**
|
|
55
|
+
* Process image documents by converting them to a standardized format
|
|
56
|
+
*/
|
|
57
|
+
private processImageDocument;
|
|
58
|
+
/**
|
|
59
|
+
* Process text-based documents using LlamaParser or fallback methods
|
|
60
|
+
*/
|
|
61
|
+
private processTextDocument;
|
|
62
|
+
/**
|
|
63
|
+
* Extract data using LLM - either structured with schema or unstructured with prompt
|
|
64
|
+
*/
|
|
65
|
+
private extractStructuredData;
|
|
66
|
+
/**
|
|
67
|
+
* Check if file is an image type
|
|
68
|
+
*/
|
|
69
|
+
private isImageFile;
|
|
70
|
+
/**
|
|
71
|
+
* Infer file type from buffer content
|
|
72
|
+
*/
|
|
73
|
+
private inferFileTypeFromBuffer;
|
|
74
|
+
/**
|
|
75
|
+
* Infer file type from URL
|
|
76
|
+
*/
|
|
77
|
+
private inferFileTypeFromUrl;
|
|
78
|
+
/**
|
|
79
|
+
* Get list of supported document types
|
|
80
|
+
*/
|
|
81
|
+
static getSupportedDocumentTypes(): string[];
|
|
82
|
+
/**
|
|
83
|
+
* Check if a file type is supported
|
|
84
|
+
*/
|
|
85
|
+
static isDocumentTypeSupported(fileType: string): boolean;
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=documentProcessor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documentProcessor.d.ts","sourceRoot":"","sources":["../../src/utils/documentProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAQzE,MAAM,WAAW,uBAAuB;IACtC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,yBAAyB;IACxC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,SAAS,CAAC,GAAG,CAAC,G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