@minded-ai/mindedjs 2.0.5 → 2.0.6-beta-2

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.
Files changed (152) hide show
  1. package/dist/agent.d.ts.map +1 -1
  2. package/dist/agent.js +6 -0
  3. package/dist/agent.js.map +1 -1
  4. package/dist/cli/index.js +0 -0
  5. package/dist/cli/lambdaHandlerTemplate.d.ts +4 -0
  6. package/dist/cli/lambdaHandlerTemplate.d.ts.map +1 -1
  7. package/dist/cli/lambdaHandlerTemplate.js +51 -37
  8. package/dist/cli/lambdaHandlerTemplate.js.map +1 -1
  9. package/dist/cli/lambdaHandlerTemplate.ts +53 -38
  10. package/dist/debugging/llmCallbackHandler.d.ts +0 -47
  11. package/dist/debugging/llmCallbackHandler.d.ts.map +1 -1
  12. package/dist/debugging/llmCallbackHandler.js +6 -7
  13. package/dist/debugging/llmCallbackHandler.js.map +1 -1
  14. package/dist/guidelines/guidelinesManager.d.ts +37 -0
  15. package/dist/guidelines/guidelinesManager.d.ts.map +1 -0
  16. package/dist/guidelines/guidelinesManager.js +172 -0
  17. package/dist/guidelines/guidelinesManager.js.map +1 -0
  18. package/dist/internalTools/documentExtraction.d.ts +69 -0
  19. package/dist/internalTools/documentExtraction.d.ts.map +1 -0
  20. package/dist/internalTools/documentExtraction.js +65 -0
  21. package/dist/internalTools/documentExtraction.js.map +1 -0
  22. package/dist/internalTools/managedDocumentParser/managedDocumentParser.d.ts +10 -0
  23. package/dist/internalTools/managedDocumentParser/managedDocumentParser.d.ts.map +1 -0
  24. package/dist/internalTools/managedDocumentParser/managedDocumentParser.js +80 -0
  25. package/dist/internalTools/managedDocumentParser/managedDocumentParser.js.map +1 -0
  26. package/dist/internalTools/retell.d.ts +12 -0
  27. package/dist/internalTools/retell.d.ts.map +1 -0
  28. package/dist/internalTools/retell.js +44 -0
  29. package/dist/internalTools/retell.js.map +1 -0
  30. package/dist/internalTools/sendPlaceholderMessage.d.ts +14 -0
  31. package/dist/internalTools/sendPlaceholderMessage.d.ts.map +1 -0
  32. package/dist/internalTools/sendPlaceholderMessage.js +51 -0
  33. package/dist/internalTools/sendPlaceholderMessage.js.map +1 -0
  34. package/dist/internalTools/timer.d.ts +1 -1
  35. package/dist/internalTools/timer.js +1 -1
  36. package/dist/pii-gateway/gateway.d.ts +17 -0
  37. package/dist/pii-gateway/gateway.d.ts.map +1 -0
  38. package/dist/pii-gateway/gateway.js +77 -0
  39. package/dist/pii-gateway/gateway.js.map +1 -0
  40. package/dist/pii-gateway/index.d.ts +4 -0
  41. package/dist/pii-gateway/index.d.ts.map +1 -0
  42. package/dist/pii-gateway/index.js +14 -0
  43. package/dist/pii-gateway/index.js.map +1 -0
  44. package/dist/pii-gateway/proxy.d.ts +80 -0
  45. package/dist/pii-gateway/proxy.d.ts.map +1 -0
  46. package/dist/pii-gateway/proxy.js +106 -0
  47. package/dist/pii-gateway/proxy.js.map +1 -0
  48. package/dist/pii-gateway/types.d.ts +27 -0
  49. package/dist/pii-gateway/types.d.ts.map +1 -0
  50. package/dist/pii-gateway/types.js +3 -0
  51. package/dist/pii-gateway/types.js.map +1 -0
  52. package/dist/platform/mindedChatOpenAI.d.ts +5 -0
  53. package/dist/platform/mindedChatOpenAI.d.ts.map +1 -0
  54. package/dist/platform/mindedChatOpenAI.js +23 -0
  55. package/dist/platform/mindedChatOpenAI.js.map +1 -0
  56. package/dist/platform/mindedConnection.d.ts.map +1 -1
  57. package/dist/platform/mindedConnection.js +33 -20
  58. package/dist/platform/mindedConnection.js.map +1 -1
  59. package/dist/platform/mindedUtils.d.ts +1 -0
  60. package/dist/platform/mindedUtils.d.ts.map +1 -0
  61. package/dist/platform/mindedUtils.js +2 -0
  62. package/dist/platform/mindedUtils.js.map +1 -0
  63. package/dist/platform/parallelAzureChatOpenAI.d.ts +39 -0
  64. package/dist/platform/parallelAzureChatOpenAI.d.ts.map +1 -0
  65. package/dist/platform/parallelAzureChatOpenAI.js +114 -0
  66. package/dist/platform/parallelAzureChatOpenAI.js.map +1 -0
  67. package/dist/platform/parallelChatOpenAI.d.ts +38 -0
  68. package/dist/platform/parallelChatOpenAI.d.ts.map +1 -0
  69. package/dist/platform/parallelChatOpenAI.js +111 -0
  70. package/dist/platform/parallelChatOpenAI.js.map +1 -0
  71. package/dist/platform/parallelMindedChatOpenAI.d.ts +39 -0
  72. package/dist/platform/parallelMindedChatOpenAI.d.ts.map +1 -0
  73. package/dist/platform/parallelMindedChatOpenAI.js +111 -0
  74. package/dist/platform/parallelMindedChatOpenAI.js.map +1 -0
  75. package/dist/platform/piiGateway/proxy.d.ts +20 -0
  76. package/dist/platform/piiGateway/proxy.d.ts.map +1 -0
  77. package/dist/platform/piiGateway/proxy.js +24 -0
  78. package/dist/platform/piiGateway/proxy.js.map +1 -0
  79. package/dist/types/Agent.d.ts +2 -0
  80. package/dist/types/Agent.d.ts.map +1 -0
  81. package/dist/types/Agent.js +18 -0
  82. package/dist/types/Agent.js.map +1 -0
  83. package/dist/types/Flows.d.ts +2 -0
  84. package/dist/types/Flows.d.ts.map +1 -0
  85. package/dist/types/Flows.js +18 -0
  86. package/dist/types/Flows.js.map +1 -0
  87. package/dist/types/LLM.d.ts +2 -0
  88. package/dist/types/LLM.d.ts.map +1 -0
  89. package/dist/types/LLM.js +18 -0
  90. package/dist/types/LLM.js.map +1 -0
  91. package/dist/types/LangGraph.d.ts +2 -0
  92. package/dist/types/LangGraph.d.ts.map +1 -0
  93. package/dist/types/LangGraph.js +18 -0
  94. package/dist/types/LangGraph.js.map +1 -0
  95. package/dist/types/Platform.d.ts +2 -0
  96. package/dist/types/Platform.d.ts.map +1 -0
  97. package/dist/types/Platform.js +18 -0
  98. package/dist/types/Platform.js.map +1 -0
  99. package/dist/types/Tools.d.ts +2 -0
  100. package/dist/types/Tools.d.ts.map +1 -0
  101. package/dist/types/Tools.js +18 -0
  102. package/dist/types/Tools.js.map +1 -0
  103. package/dist/types/Triggers.d.ts +2 -0
  104. package/dist/types/Triggers.d.ts.map +1 -0
  105. package/dist/types/Triggers.js +18 -0
  106. package/dist/types/Triggers.js.map +1 -0
  107. package/dist/types/Triggers.types.d.ts +25 -0
  108. package/dist/types/Triggers.types.d.ts.map +1 -0
  109. package/dist/types/Triggers.types.js +3 -0
  110. package/dist/types/Triggers.types.js.map +1 -0
  111. package/dist/types/Voice.d.ts +2 -0
  112. package/dist/types/Voice.d.ts.map +1 -0
  113. package/dist/types/Voice.js +18 -0
  114. package/dist/types/Voice.js.map +1 -0
  115. package/dist/types/index.d.ts +9 -0
  116. package/dist/types/index.d.ts.map +1 -0
  117. package/dist/types/index.js +25 -0
  118. package/dist/types/index.js.map +1 -0
  119. package/dist/utils/LogicalConditionDebugger.d.ts +57 -0
  120. package/dist/utils/LogicalConditionDebugger.d.ts.map +1 -0
  121. package/dist/utils/LogicalConditionDebugger.js +143 -0
  122. package/dist/utils/LogicalConditionDebugger.js.map +1 -0
  123. package/dist/utils/documentProcessor.d.ts +87 -0
  124. package/dist/utils/documentProcessor.d.ts.map +1 -0
  125. package/dist/utils/documentProcessor.js +726 -0
  126. package/dist/utils/documentProcessor.js.map +1 -0
  127. package/dist/utils/extractStateMemoryResponse.d.ts +1 -0
  128. package/dist/utils/extractStateMemoryResponse.d.ts.map +1 -0
  129. package/dist/utils/extractStateMemoryResponse.js +89 -0
  130. package/dist/utils/extractStateMemoryResponse.js.map +1 -0
  131. package/dist/utils/extractToolGuidelineParams.d.ts +4 -0
  132. package/dist/utils/extractToolGuidelineParams.d.ts.map +1 -0
  133. package/dist/utils/extractToolGuidelineParams.js +20 -0
  134. package/dist/utils/extractToolGuidelineParams.js.map +1 -0
  135. package/dist/utils/extractToolMemoryResponse.d.ts +4 -0
  136. package/dist/utils/extractToolMemoryResponse.d.ts.map +1 -0
  137. package/dist/utils/extractToolMemoryResponse.js +16 -0
  138. package/dist/utils/extractToolMemoryResponse.js.map +1 -0
  139. package/dist/utils/logger.d.ts.map +1 -1
  140. package/dist/utils/logger.js +1 -0
  141. package/dist/utils/logger.js.map +1 -1
  142. package/dist/utils/parseAttachments.d.ts +14 -0
  143. package/dist/utils/parseAttachments.d.ts.map +1 -0
  144. package/dist/utils/parseAttachments.js +54 -0
  145. package/dist/utils/parseAttachments.js.map +1 -0
  146. package/package.json +2 -2
  147. package/src/agent.ts +5 -0
  148. package/src/cli/lambdaHandlerTemplate.ts +53 -38
  149. package/src/debugging/llmCallbackHandler.ts +6 -7
  150. package/src/internalTools/timer.ts +1 -1
  151. package/src/platform/mindedConnection.ts +38 -20
  152. package/src/utils/logger.ts +1 -0
@@ -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,2 @@
1
+ export * from './Tools.types';
2
+ //# sourceMappingURL=Tools.d.ts.map
@@ -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"}
@@ -0,0 +1,2 @@
1
+ export * from './Triggers.types';
2
+ //# sourceMappingURL=Triggers.d.ts.map
@@ -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,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=Triggers.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Triggers.types.js","sourceRoot":"","sources":["../../src/types/Triggers.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export * from './Voice.types';
2
+ //# sourceMappingURL=Voice.d.ts.map
@@ -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,9 @@
1
+ export * from './Agent';
2
+ export * from './Tools';
3
+ export * from './Flows';
4
+ export * from './Triggers';
5
+ export * from './LLM';
6
+ export * from './Voice';
7
+ export * from './Platform';
8
+ export * from './LangGraph';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -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,CAAC;IAED;;;OAGG;IACH,iBAAiB,CAAC,IAAwB;QACxC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC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L,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,EAA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