@minded-ai/mindedjs 2.0.13-beta.9 → 2.0.14-beta-1

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 (167) hide show
  1. package/dist/agent.d.ts.map +1 -1
  2. package/dist/agent.js +16 -6
  3. package/dist/agent.js.map +1 -1
  4. package/dist/browserTask/README.md +419 -0
  5. package/dist/browserTask/browserAgent.py +632 -0
  6. package/dist/browserTask/captcha_isolated.png +0 -0
  7. package/dist/browserTask/executeBrowserTask.d.ts +2 -2
  8. package/dist/browserTask/executeBrowserTask.d.ts.map +1 -1
  9. package/dist/browserTask/executeBrowserTask.js +7 -28
  10. package/dist/browserTask/executeBrowserTask.js.map +1 -1
  11. package/dist/browserTask/executeBrowserTask.ts +79 -0
  12. package/dist/browserTask/requirements.txt +8 -0
  13. package/dist/browserTask/setup.sh +144 -0
  14. package/dist/cli/index.js +7 -35
  15. package/dist/cli/index.js.map +1 -1
  16. package/dist/cli/lambdaHandlerTemplate.d.ts.map +1 -1
  17. package/dist/cli/lambdaHandlerTemplate.js +2 -1
  18. package/dist/cli/lambdaHandlerTemplate.js.map +1 -1
  19. package/dist/cli/lambdaHandlerTemplate.ts +3 -2
  20. package/dist/internalTools/retell.js +17 -7
  21. package/dist/internalTools/retell.js.map +1 -1
  22. package/dist/internalTools/sendPlaceholderMessage.js +17 -7
  23. package/dist/internalTools/sendPlaceholderMessage.js.map +1 -1
  24. package/dist/nodes/addBrowserTaskNode.js +2 -2
  25. package/dist/nodes/addBrowserTaskNode.js.map +1 -1
  26. package/dist/nodes/addBrowserTaskRunNode.d.ts.map +1 -1
  27. package/dist/nodes/addBrowserTaskRunNode.js +4 -1
  28. package/dist/nodes/addBrowserTaskRunNode.js.map +1 -1
  29. package/dist/toolsLibrary/classifier.d.ts.map +1 -1
  30. package/dist/toolsLibrary/classifier.js +103 -33
  31. package/dist/toolsLibrary/classifier.js.map +1 -1
  32. package/dist/types/LLM.types.js.map +1 -1
  33. package/dist/utils/extractStateMemoryResponse.d.ts +4 -0
  34. package/dist/utils/extractStateMemoryResponse.d.ts.map +1 -1
  35. package/dist/utils/extractStateMemoryResponse.js +89 -87
  36. package/dist/utils/extractStateMemoryResponse.js.map +1 -1
  37. package/package.json +1 -1
  38. package/src/agent.ts +15 -6
  39. package/src/browserTask/executeBrowserTask.ts +22 -47
  40. package/src/cli/index.ts +7 -34
  41. package/src/cli/lambdaHandlerTemplate.ts +3 -2
  42. package/src/nodes/addBrowserTaskNode.ts +2 -2
  43. package/src/nodes/addBrowserTaskRunNode.ts +5 -1
  44. package/src/toolsLibrary/classifier.ts +115 -37
  45. package/src/types/LLM.types.ts +2 -2
  46. package/dist/cli/localOperatorSetup.d.ts +0 -6
  47. package/dist/cli/localOperatorSetup.d.ts.map +0 -1
  48. package/dist/cli/localOperatorSetup.js +0 -300
  49. package/dist/cli/localOperatorSetup.js.map +0 -1
  50. package/dist/guidelines/guidelinesManager.d.ts +0 -37
  51. package/dist/guidelines/guidelinesManager.d.ts.map +0 -1
  52. package/dist/guidelines/guidelinesManager.js +0 -172
  53. package/dist/guidelines/guidelinesManager.js.map +0 -1
  54. package/dist/internalTools/documentExtraction.d.ts +0 -69
  55. package/dist/internalTools/documentExtraction.d.ts.map +0 -1
  56. package/dist/internalTools/documentExtraction.js +0 -65
  57. package/dist/internalTools/documentExtraction.js.map +0 -1
  58. package/dist/internalTools/managedDocumentParser/managedDocumentParser.d.ts +0 -10
  59. package/dist/internalTools/managedDocumentParser/managedDocumentParser.d.ts.map +0 -1
  60. package/dist/internalTools/managedDocumentParser/managedDocumentParser.js +0 -80
  61. package/dist/internalTools/managedDocumentParser/managedDocumentParser.js.map +0 -1
  62. package/dist/pii-gateway/gateway.d.ts +0 -17
  63. package/dist/pii-gateway/gateway.d.ts.map +0 -1
  64. package/dist/pii-gateway/gateway.js +0 -77
  65. package/dist/pii-gateway/gateway.js.map +0 -1
  66. package/dist/pii-gateway/index.d.ts +0 -4
  67. package/dist/pii-gateway/index.d.ts.map +0 -1
  68. package/dist/pii-gateway/index.js +0 -14
  69. package/dist/pii-gateway/index.js.map +0 -1
  70. package/dist/pii-gateway/proxy.d.ts +0 -80
  71. package/dist/pii-gateway/proxy.d.ts.map +0 -1
  72. package/dist/pii-gateway/proxy.js +0 -106
  73. package/dist/pii-gateway/proxy.js.map +0 -1
  74. package/dist/pii-gateway/types.d.ts +0 -27
  75. package/dist/pii-gateway/types.d.ts.map +0 -1
  76. package/dist/pii-gateway/types.js +0 -3
  77. package/dist/pii-gateway/types.js.map +0 -1
  78. package/dist/platform/mindedChatOpenAI.d.ts +0 -5
  79. package/dist/platform/mindedChatOpenAI.d.ts.map +0 -1
  80. package/dist/platform/mindedChatOpenAI.js +0 -23
  81. package/dist/platform/mindedChatOpenAI.js.map +0 -1
  82. package/dist/platform/mindedUtils.d.ts +0 -1
  83. package/dist/platform/mindedUtils.d.ts.map +0 -1
  84. package/dist/platform/mindedUtils.js +0 -2
  85. package/dist/platform/mindedUtils.js.map +0 -1
  86. package/dist/platform/parallelAzureChatOpenAI.d.ts +0 -39
  87. package/dist/platform/parallelAzureChatOpenAI.d.ts.map +0 -1
  88. package/dist/platform/parallelAzureChatOpenAI.js +0 -114
  89. package/dist/platform/parallelAzureChatOpenAI.js.map +0 -1
  90. package/dist/platform/parallelChatOpenAI.d.ts +0 -38
  91. package/dist/platform/parallelChatOpenAI.d.ts.map +0 -1
  92. package/dist/platform/parallelChatOpenAI.js +0 -111
  93. package/dist/platform/parallelChatOpenAI.js.map +0 -1
  94. package/dist/platform/parallelMindedChatOpenAI.d.ts +0 -39
  95. package/dist/platform/parallelMindedChatOpenAI.d.ts.map +0 -1
  96. package/dist/platform/parallelMindedChatOpenAI.js +0 -111
  97. package/dist/platform/parallelMindedChatOpenAI.js.map +0 -1
  98. package/dist/platform/piiGateway/proxy.d.ts +0 -20
  99. package/dist/platform/piiGateway/proxy.d.ts.map +0 -1
  100. package/dist/platform/piiGateway/proxy.js +0 -24
  101. package/dist/platform/piiGateway/proxy.js.map +0 -1
  102. package/dist/toolsLibrary/browser/extraction.d.ts +0 -83
  103. package/dist/toolsLibrary/browser/extraction.d.ts.map +0 -1
  104. package/dist/toolsLibrary/browser/extraction.js +0 -328
  105. package/dist/toolsLibrary/browser/extraction.js.map +0 -1
  106. package/dist/types/Agent.d.ts +0 -2
  107. package/dist/types/Agent.d.ts.map +0 -1
  108. package/dist/types/Agent.js +0 -18
  109. package/dist/types/Agent.js.map +0 -1
  110. package/dist/types/Flows.d.ts +0 -2
  111. package/dist/types/Flows.d.ts.map +0 -1
  112. package/dist/types/Flows.js +0 -18
  113. package/dist/types/Flows.js.map +0 -1
  114. package/dist/types/LLM.d.ts +0 -2
  115. package/dist/types/LLM.d.ts.map +0 -1
  116. package/dist/types/LLM.js +0 -18
  117. package/dist/types/LLM.js.map +0 -1
  118. package/dist/types/LangGraph.d.ts +0 -2
  119. package/dist/types/LangGraph.d.ts.map +0 -1
  120. package/dist/types/LangGraph.js +0 -18
  121. package/dist/types/LangGraph.js.map +0 -1
  122. package/dist/types/Platform.d.ts +0 -2
  123. package/dist/types/Platform.d.ts.map +0 -1
  124. package/dist/types/Platform.js +0 -18
  125. package/dist/types/Platform.js.map +0 -1
  126. package/dist/types/Tools.d.ts +0 -2
  127. package/dist/types/Tools.d.ts.map +0 -1
  128. package/dist/types/Tools.js +0 -18
  129. package/dist/types/Tools.js.map +0 -1
  130. package/dist/types/Triggers.d.ts +0 -2
  131. package/dist/types/Triggers.d.ts.map +0 -1
  132. package/dist/types/Triggers.js +0 -18
  133. package/dist/types/Triggers.js.map +0 -1
  134. package/dist/types/Triggers.types.d.ts +0 -25
  135. package/dist/types/Triggers.types.d.ts.map +0 -1
  136. package/dist/types/Triggers.types.js +0 -3
  137. package/dist/types/Triggers.types.js.map +0 -1
  138. package/dist/types/Voice.d.ts +0 -2
  139. package/dist/types/Voice.d.ts.map +0 -1
  140. package/dist/types/Voice.js +0 -18
  141. package/dist/types/Voice.js.map +0 -1
  142. package/dist/types/index.d.ts +0 -9
  143. package/dist/types/index.d.ts.map +0 -1
  144. package/dist/types/index.js +0 -25
  145. package/dist/types/index.js.map +0 -1
  146. package/dist/utils/LogicalConditionDebugger.d.ts +0 -57
  147. package/dist/utils/LogicalConditionDebugger.d.ts.map +0 -1
  148. package/dist/utils/LogicalConditionDebugger.js +0 -143
  149. package/dist/utils/LogicalConditionDebugger.js.map +0 -1
  150. package/dist/utils/documentProcessor.d.ts +0 -87
  151. package/dist/utils/documentProcessor.d.ts.map +0 -1
  152. package/dist/utils/documentProcessor.js +0 -726
  153. package/dist/utils/documentProcessor.js.map +0 -1
  154. package/dist/utils/extractToolGuidelineParams.d.ts +0 -4
  155. package/dist/utils/extractToolGuidelineParams.d.ts.map +0 -1
  156. package/dist/utils/extractToolGuidelineParams.js +0 -20
  157. package/dist/utils/extractToolGuidelineParams.js.map +0 -1
  158. package/dist/utils/extractToolMemoryResponse.d.ts +0 -4
  159. package/dist/utils/extractToolMemoryResponse.d.ts.map +0 -1
  160. package/dist/utils/extractToolMemoryResponse.js +0 -16
  161. package/dist/utils/extractToolMemoryResponse.js.map +0 -1
  162. package/dist/utils/parseAttachments.d.ts +0 -14
  163. package/dist/utils/parseAttachments.d.ts.map +0 -1
  164. package/dist/utils/parseAttachments.js +0 -54
  165. package/dist/utils/parseAttachments.js.map +0 -1
  166. package/src/cli/localOperatorSetup.ts +0 -308
  167. package/src/toolsLibrary/browser/extraction.ts +0 -393
@@ -1,39 +0,0 @@
1
- import { ChatOpenAIFields } from '@langchain/openai';
2
- import { MindedChatOpenAI } from './mindedChatOpenAI';
3
- import { BaseMessage } from '@langchain/core/messages';
4
- import { ChatGenerationChunk, ChatResult } from '@langchain/core/outputs';
5
- import { CallbackManagerForLLMRun } from '@langchain/core/callbacks/manager';
6
- export interface ParallelMindedChatOpenAIFields extends ChatOpenAIFields {
7
- /**
8
- * Number of parallel requests to make. Defaults to 1 (no parallelization).
9
- * When > 1, multiple identical requests are sent and the fastest response is used.
10
- */
11
- numParallelRequests?: number;
12
- /**
13
- * Whether to log timing information for parallel requests
14
- */
15
- logTimings?: boolean;
16
- }
17
- /**
18
- * Extended MindedChatOpenAI that supports parallel request optimization.
19
- * When numParallelRequests > 1, it sends multiple identical requests
20
- * and returns the fastest response to reduce latency.
21
- */
22
- export declare class ParallelMindedChatOpenAI extends MindedChatOpenAI {
23
- private numParallelRequests;
24
- private logTimings;
25
- constructor(fields?: ParallelMindedChatOpenAIFields);
26
- /**
27
- * Helper function that returns a promise that resolves with the second fulfilled promise
28
- */
29
- private promiseSecondFulfillment;
30
- /**
31
- * Override the _generate method to implement parallel requests
32
- */
33
- _generate(messages: BaseMessage[], options?: this['ParsedCallOptions'], runManager?: CallbackManagerForLLMRun): Promise<ChatResult>;
34
- /**
35
- * Override the _streamResponseChunks method to implement parallel streaming
36
- */
37
- _streamResponseChunks(messages: BaseMessage[], options?: this['ParsedCallOptions'], runManager?: CallbackManagerForLLMRun): AsyncGenerator<ChatGenerationChunk>;
38
- }
39
- //# sourceMappingURL=parallelMindedChatOpenAI.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parallelMindedChatOpenAI.d.ts","sourceRoot":"","sources":["../../src/platform/parallelMindedChatOpenAI.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAG7E,MAAM,WAAW,8BAA+B,SAAQ,gBAAgB;IACtE;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;GAIG;AACH,qBAAa,wBAAyB,SAAQ,gBAAgB;IAC5D,OAAO,CAAC,mBAAmB,CAAS;IACpC,OAAO,CAAC,UAAU,CAAU;gBAEhB,MAAM,CAAC,EAAE,8BAA8B;IAMnD;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAmBhC;;OAEG;IACG,SAAS,CACb,QAAQ,EAAE,WAAW,EAAE,EACvB,OAAO,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC,EACnC,UAAU,CAAC,EAAE,wBAAwB,GACpC,OAAO,CAAC,UAAU,CAAC;IAkEtB;;OAEG;IACI,qBAAqB,CAC1B,QAAQ,EAAE,WAAW,EAAE,EACvB,OAAO,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC,EACnC,UAAU,CAAC,EAAE,wBAAwB,GACpC,cAAc,CAAC,mBAAmB,CAAC;CAYvC"}
@@ -1,111 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ParallelMindedChatOpenAI = void 0;
4
- const mindedChatOpenAI_1 = require("./mindedChatOpenAI");
5
- const logger_1 = require("../utils/logger");
6
- /**
7
- * Extended MindedChatOpenAI that supports parallel request optimization.
8
- * When numParallelRequests > 1, it sends multiple identical requests
9
- * and returns the fastest response to reduce latency.
10
- */
11
- class ParallelMindedChatOpenAI extends mindedChatOpenAI_1.MindedChatOpenAI {
12
- constructor(fields) {
13
- super(fields);
14
- this.numParallelRequests = (fields === null || fields === void 0 ? void 0 : fields.numParallelRequests) || 1;
15
- this.logTimings = (fields === null || fields === void 0 ? void 0 : fields.logTimings) || false;
16
- }
17
- /**
18
- * Helper function that returns a promise that resolves with the second fulfilled promise
19
- */
20
- promiseSecondFulfillment(promises) {
21
- return new Promise((resolve) => {
22
- let fulfillCount = 0;
23
- for (const p of promises) {
24
- Promise.resolve(p)
25
- .then((value) => {
26
- fulfillCount++;
27
- if (fulfillCount === 2) {
28
- resolve(value);
29
- }
30
- })
31
- .catch(() => {
32
- // Ignoring rejections for second fulfillment tracking
33
- });
34
- }
35
- });
36
- }
37
- /**
38
- * Override the _generate method to implement parallel requests
39
- */
40
- async _generate(messages, options, runManager) {
41
- // If parallel requests are disabled, use the parent implementation
42
- if (this.numParallelRequests <= 1) {
43
- return super._generate(messages, options, runManager);
44
- }
45
- const startTime = Date.now();
46
- // Create array of identical requests
47
- const requests = Array.from({ length: this.numParallelRequests }, () => super._generate(messages, options, runManager));
48
- let fastestRequestTime = 0;
49
- let secondFastestRequestTime = 0;
50
- // Race all requests and return the fastest
51
- const racePromise = Promise.race(requests).then((result) => {
52
- fastestRequestTime = (Date.now() - startTime) / 1000.0;
53
- if (this.logTimings) {
54
- logger_1.logger.debug({
55
- msg: '[ParallelLLM] Fastest request completed',
56
- requestTime: fastestRequestTime,
57
- numParallelRequests: this.numParallelRequests,
58
- });
59
- }
60
- return result;
61
- });
62
- // Track second fastest if we have 3+ requests
63
- if (requests.length >= 3) {
64
- this.promiseSecondFulfillment(requests)
65
- .then(() => {
66
- secondFastestRequestTime = (Date.now() - startTime) / 1000.0;
67
- })
68
- .catch(() => {
69
- // Ignore errors in timing tracking
70
- });
71
- }
72
- // Track all completion times if we have 2+ requests
73
- if (requests.length >= 2 && this.logTimings) {
74
- Promise.all(requests)
75
- .then(() => {
76
- const allFinishTime = (Date.now() - startTime) / 1000.0;
77
- const timeSaved = allFinishTime - fastestRequestTime;
78
- const timeSavedFromSecond = secondFastestRequestTime > 0 ? secondFastestRequestTime - fastestRequestTime : 0;
79
- logger_1.logger.debug({
80
- msg: '[ParallelLLM] Time saved using parallel requests',
81
- fastestRequestTime,
82
- secondFastestRequestTime: secondFastestRequestTime || 'N/A',
83
- allFinishTime,
84
- timeSaved,
85
- timeSavedFromSecond,
86
- numParallelRequests: this.numParallelRequests,
87
- });
88
- })
89
- .catch(() => {
90
- // Ignore errors in timing tracking
91
- });
92
- }
93
- return racePromise;
94
- }
95
- /**
96
- * Override the _streamResponseChunks method to implement parallel streaming
97
- */
98
- async *_streamResponseChunks(messages, options, runManager) {
99
- // For streaming, we'll use the parent implementation for now
100
- // Parallel streaming is more complex and may not provide the same benefits
101
- if (this.numParallelRequests > 1 && this.logTimings) {
102
- logger_1.logger.debug({
103
- msg: '[ParallelLLM] Streaming mode - using single request',
104
- reason: 'Parallel streaming not implemented',
105
- });
106
- }
107
- yield* super._streamResponseChunks(messages, options, runManager);
108
- }
109
- }
110
- exports.ParallelMindedChatOpenAI = ParallelMindedChatOpenAI;
111
- //# sourceMappingURL=parallelMindedChatOpenAI.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parallelMindedChatOpenAI.js","sourceRoot":"","sources":["../../src/platform/parallelMindedChatOpenAI.ts"],"names":[],"mappings":";;;AACA,yDAAsD;AAItD,4CAAyC;AAezC;;;;GAIG;AACH,MAAa,wBAAyB,SAAQ,mCAAgB;IAI5D,YAAY,MAAuC;QACjD,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,mBAAmB,GAAG,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,mBAAmB,KAAI,CAAC,CAAC;QAC5D,IAAI,CAAC,UAAU,GAAG,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,UAAU,KAAI,KAAK,CAAC;IAChD,CAAC;IAED;;OAEG;IACK,wBAAwB,CAAI,QAAsB;QACxD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC7B,IAAI,YAAY,GAAG,CAAC,CAAC;YAErB,KAAK,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;gBACzB,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;qBACf,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE;oBACd,YAAY,EAAE,CAAC;oBACf,IAAI,YAAY,KAAK,CAAC,EAAE,CAAC;wBACvB,OAAO,CAAC,KAAK,CAAC,CAAC;oBACjB,CAAC;gBACH,CAAC,CAAC;qBACD,KAAK,CAAC,GAAG,EAAE;oBACV,sDAAsD;gBACxD,CA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BAC1D,MAAM,EAAE,oCAAoC;aAC7C,CAAC,CAAC;QACL,CAAC;QAED,KAAK,CAAC,CAAC,KAAK,CAAC,qBAAqB,CAAC,QAAQ,EAAE,OAAQ,EAAE,UAAU,CAAC,CAAC;IACrE,CAAC;CACF;AA5HD,4DA4HC"}
@@ -1,20 +0,0 @@
1
- import { MindedConnection } from '../mindedConnection';
2
- import { PIIGatewayInstance } from './types';
3
- /**
4
- * Create a PII Gateway instance with a specific Minded connection and session ID.
5
- * This is used internally by the Agent and for advanced use cases.
6
- *
7
- * @param mindedConnection - The Minded connection to use for the requests
8
- * @param sessionId - Session ID for PII context (required for proper masking)
9
- * @returns A PII Gateway instance
10
- *
11
- * @example
12
- * ```typescript
13
- * import { createPIIGateway } from '@minded-ai/mindedjs';
14
- *
15
- * const piiGateway = createPIIGateway(mindedConnection, 'session-123');
16
- * const response = await piiGateway.get('/api/data');
17
- * ```
18
- */
19
- export declare function createPIIGateway(mindedConnection: MindedConnection, sessionId: string): PIIGatewayInstance;
20
- //# sourceMappingURL=proxy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../../src/platform/piiGateway/proxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAG7C;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,GAAG,kBAAkB,CAE1G"}
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createPIIGateway = createPIIGateway;
4
- const gateway_1 = require("./gateway");
5
- /**
6
- * Create a PII Gateway instance with a specific Minded connection and session ID.
7
- * This is used internally by the Agent and for advanced use cases.
8
- *
9
- * @param mindedConnection - The Minded connection to use for the requests
10
- * @param sessionId - Session ID for PII context (required for proper masking)
11
- * @returns A PII Gateway instance
12
- *
13
- * @example
14
- * ```typescript
15
- * import { createPIIGateway } from '@minded-ai/mindedjs';
16
- *
17
- * const piiGateway = createPIIGateway(mindedConnection, 'session-123');
18
- * const response = await piiGateway.get('/api/data');
19
- * ```
20
- */
21
- function createPIIGateway(mindedConnection, sessionId) {
22
- return new gateway_1.PIIGateway(mindedConnection, sessionId);
23
- }
24
- //# sourceMappingURL=proxy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../../src/platform/piiGateway/proxy.ts"],"names":[],"mappings":";;AAoBA,4CAEC;AApBD,uCAAuC;AAEvC;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,gBAAgB,CAAC,gBAAkC,EAAE,SAAiB;IACpF,OAAO,IAAI,oBAAU,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAC;AACrD,CAAC"}
@@ -1,83 +0,0 @@
1
- import { z } from 'zod';
2
- import { Tool } from '../../types/Tools.types';
3
- import { BaseLanguageModel } from '@langchain/core/language_models/base';
4
- export type ExtractionSchema = z.ZodTypeAny;
5
- export interface ExtractionConfig {
6
- schema: ExtractionSchema;
7
- systemPrompt?: string;
8
- examples?: Array<{
9
- input: string;
10
- output?: any;
11
- }>;
12
- defaultValue?: any;
13
- maxRetries?: number;
14
- strictMode?: boolean;
15
- }
16
- export type ExtractionResult = z.infer<ExtractionSchema>;
17
- /**
18
- * Generic extraction utility that can be used standalone
19
- *
20
- * When strictMode is true:
21
- * - If the LLM supports withStructuredOutput, it will use that for guaranteed schema compliance
22
- * - Otherwise, it falls back to JSON parsing with Zod validation and retries
23
- *
24
- * When strictMode is false:
25
- * - Uses JSON parsing without validation for more flexibility
26
- *
27
- * @param content The content to extract from
28
- * @param config The extraction configuration
29
- * @param llm The language model to use for extraction
30
- * @param attemptNumber Current attempt number (used internally for retries)
31
- * @returns The extraction result
32
- */
33
- export declare function extract(content: string, config: ExtractionConfig, llm: BaseLanguageModel, attemptNumber?: number): Promise<ExtractionResult>;
34
- /**
35
- * Create a simple extractor for common use cases
36
- * @param schemaOrPrompt Either a Zod schema or a simple prompt string
37
- * @param options Additional configuration options
38
- * @returns A configured extract function
39
- */
40
- export declare function createExtractor(schemaOrPrompt: ExtractionSchema | string, options?: Partial<ExtractionConfig>): (content: string, llm: BaseLanguageModel) => Promise<any>;
41
- export declare const schema: z.ZodObject<{
42
- content: z.ZodString;
43
- schema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
44
- systemPrompt: z.ZodOptional<z.ZodString>;
45
- examples: z.ZodOptional<z.ZodArray<z.ZodObject<{
46
- input: z.ZodString;
47
- output: z.ZodAny;
48
- }, "strip", z.ZodTypeAny, {
49
- input: string;
50
- output?: any;
51
- }, {
52
- input: string;
53
- output?: any;
54
- }>, "many">>;
55
- strictMode: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
56
- maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
57
- defaultValue: z.ZodOptional<z.ZodAny>;
58
- }, "strip", z.ZodTypeAny, {
59
- maxRetries: number;
60
- content: string;
61
- strictMode: boolean;
62
- schema?: Record<string, any> | undefined;
63
- systemPrompt?: string | undefined;
64
- examples?: {
65
- input: string;
66
- output?: any;
67
- }[] | undefined;
68
- defaultValue?: any;
69
- }, {
70
- content: string;
71
- maxRetries?: number | undefined;
72
- schema?: Record<string, any> | undefined;
73
- systemPrompt?: string | undefined;
74
- examples?: {
75
- input: string;
76
- output?: any;
77
- }[] | undefined;
78
- defaultValue?: any;
79
- strictMode?: boolean | undefined;
80
- }>;
81
- declare const extractionTool: Tool<typeof schema, any>;
82
- export default extractionTool;
83
- //# sourceMappingURL=extraction.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"extraction.d.ts","sourceRoot":"","sources":["../../../src/toolsLibrary/browser/extraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAI/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAYzE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,UAAU,CAAC;AAE5C,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,gBAAgB,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,GAAG,CAAA;KAAE,CAAC,CAAC;IAClD,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;AA0EzD;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,OAAO,CAC3B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,gBAAgB,EACxB,GAAG,EAAE,iBAAiB,EACtB,aAAa,GAAE,MAAU,GACxB,OAAO,CAAC,gBAAgB,CAAC,CA+G3B;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,cAAc,EAAE,gBAAgB,GAAG,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,aAoB3F,MAAM,OAAO,iBAAiB,kBAChD;AAGD,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBjB,CAAC;AAEH,QAAA,MAAM,cAAc,EAAE,IAAI,CAAC,OAAO,MAAM,EAAE,GAAG,CAyG5C,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -1,328 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.schema = void 0;
4
- exports.extract = extract;
5
- exports.createExtractor = createExtractor;
6
- const zod_1 = require("zod");
7
- const zod_to_json_schema_1 = require("zod-to-json-schema");
8
- const logger_1 = require("../../utils/logger");
9
- const output_parsers_1 = require("@langchain/core/output_parsers");
10
- const messages_1 = require("@langchain/core/messages");
11
- function supportsStructuredOutput(llm) {
12
- return 'withStructuredOutput' in llm && typeof llm.withStructuredOutput === 'function';
13
- }
14
- // Default configuration
15
- const DEFAULT_CONFIG = {
16
- maxRetries: 3,
17
- strictMode: true,
18
- };
19
- /**
20
- * Convert Zod schema to JSON schema format for prompt
21
- */
22
- function schemaToJsonFormat(schema) {
23
- // Use zod-to-json-schema for robust conversion
24
- const jsonSchema = (0, zod_to_json_schema_1.zodToJsonSchema)(schema, {
25
- target: 'openApi3',
26
- $refStrategy: 'none', // Inline all references for simpler prompts
27
- });
28
- // Remove the $schema property for cleaner output
29
- if (typeof jsonSchema === 'object' && jsonSchema !== null && '$schema' in jsonSchema) {
30
- delete jsonSchema.$schema;
31
- }
32
- return JSON.stringify(jsonSchema, null, 2);
33
- }
34
- /**
35
- * Build prompt with schema for JSON parsing mode
36
- */
37
- function buildPromptWithSchema(basePrompt, schema, examples, content) {
38
- const schemaDescription = schemaToJsonFormat(schema);
39
- let prompt = `${basePrompt}\n\nExpected JSON format:\n${schemaDescription}\n\n`;
40
- // Add examples if provided
41
- if (examples && examples.length > 0) {
42
- prompt += 'Examples:\n';
43
- for (const example of examples) {
44
- prompt += `Input: ${example.input}\nOutput: ${JSON.stringify(example.output)}\n\n`;
45
- }
46
- }
47
- prompt += 'Return ONLY valid JSON that matches the schema. No additional text or explanation.\n\n';
48
- prompt += `Content to extract from:\n${content}`;
49
- return prompt;
50
- }
51
- /**
52
- * Validate extraction result against Zod schema
53
- */
54
- function validateResult(result, schema) {
55
- try {
56
- // Use Zod's built-in validation
57
- schema.parse(result);
58
- return { valid: true, errors: [] };
59
- }
60
- catch (error) {
61
- if (error instanceof zod_1.z.ZodError) {
62
- // Extract error messages from Zod validation
63
- const errors = error.errors.map((err) => {
64
- const path = err.path.join('.');
65
- return path ? `${path}: ${err.message}` : err.message;
66
- });
67
- return { valid: false, errors };
68
- }
69
- // Handle non-Zod errors
70
- return { valid: false, errors: [error instanceof Error ? error.message : 'Unknown validation error'] };
71
- }
72
- }
73
- /**
74
- * Generic extraction utility that can be used standalone
75
- *
76
- * When strictMode is true:
77
- * - If the LLM supports withStructuredOutput, it will use that for guaranteed schema compliance
78
- * - Otherwise, it falls back to JSON parsing with Zod validation and retries
79
- *
80
- * When strictMode is false:
81
- * - Uses JSON parsing without validation for more flexibility
82
- *
83
- * @param content The content to extract from
84
- * @param config The extraction configuration
85
- * @param llm The language model to use for extraction
86
- * @param attemptNumber Current attempt number (used internally for retries)
87
- * @returns The extraction result
88
- */
89
- async function extract(content, config, llm, attemptNumber = 0) {
90
- const mergedConfig = { ...DEFAULT_CONFIG, ...config };
91
- try {
92
- const basePrompt = mergedConfig.systemPrompt || 'Extract structured information from the given content:';
93
- let result;
94
- if (mergedConfig.strictMode) {
95
- // Use structured output when strict mode is enabled
96
- try {
97
- // Check if the LLM supports structured output
98
- if (supportsStructuredOutput(llm)) {
99
- // When using withStructuredOutput, we don't need to include the schema in the prompt
100
- // The LLM already knows the structure from the withStructuredOutput method
101
- let prompt = basePrompt;
102
- // Add examples if provided (still useful for context)
103
- if (mergedConfig.examples && mergedConfig.examples.length > 0) {
104
- prompt += '\n\nExamples:\n';
105
- for (const example of mergedConfig.examples) {
106
- prompt += `Input: ${example.input}\nOutput: ${JSON.stringify(example.output)}\n\n`;
107
- }
108
- }
109
- prompt += `\n\nContent to extract from:\n${content}`;
110
- const structuredLLM = llm.withStructuredOutput(mergedConfig.schema);
111
- const messages = [new messages_1.SystemMessage(prompt)];
112
- result = await structuredLLM.invoke(messages);
113
- // The result should already be validated by withStructuredOutput
114
- return result;
115
- }
116
- else {
117
- // Fallback to JSON parser with validation if withStructuredOutput is not available
118
- logger_1.logger.info({
119
- message: 'LLM does not support withStructuredOutput, falling back to JSON parser with validation',
120
- });
121
- // For JSON parsing mode, we need to include the schema in the prompt
122
- const prompt = buildPromptWithSchema(basePrompt, mergedConfig.schema, mergedConfig.examples, content);
123
- const parser = new output_parsers_1.JsonOutputParser();
124
- const messages = [new messages_1.SystemMessage(prompt)];
125
- result = await llm.pipe(parser).invoke(messages);
126
- // Validate the result
127
- const validation = validateResult(result, mergedConfig.schema);
128
- if (!validation.valid && attemptNumber < (mergedConfig.maxRetries || 3)) {
129
- logger_1.logger.warn({
130
- message: 'Extraction validation failed, retrying',
131
- errors: validation.errors,
132
- attempt: attemptNumber + 1,
133
- });
134
- // Add validation errors to prompt for retry
135
- const retryConfig = {
136
- ...config,
137
- systemPrompt: `${basePrompt}\n\nPrevious attempt had these errors:\n${validation.errors.join('\n')}\n\nPlease correct these issues and provide valid JSON.`,
138
- };
139
- return extract(content, retryConfig, llm, attemptNumber + 1);
140
- }
141
- else if (!validation.valid) {
142
- logger_1.logger.error({
143
- message: 'Extraction validation failed after max retries',
144
- errors: validation.errors,
145
- });
146
- if (mergedConfig.defaultValue) {
147
- return mergedConfig.defaultValue;
148
- }
149
- throw new Error(`Extraction validation failed: ${validation.errors.join(', ')}`);
150
- }
151
- }
152
- }
153
- catch (err) {
154
- // If structured output fails, retry with adjusted config
155
- if (attemptNumber < (mergedConfig.maxRetries || 3)) {
156
- logger_1.logger.warn({
157
- message: 'Structured output failed, retrying',
158
- error: err instanceof Error ? err.message : 'Unknown error',
159
- attempt: attemptNumber + 1,
160
- });
161
- return extract(content, config, llm, attemptNumber + 1);
162
- }
163
- else {
164
- throw err;
165
- }
166
- }
167
- }
168
- else {
169
- // Non-strict mode: use JSON parser without validation
170
- const prompt = buildPromptWithSchema(basePrompt, mergedConfig.schema, mergedConfig.examples, content);
171
- const parser = new output_parsers_1.JsonOutputParser();
172
- const messages = [new messages_1.SystemMessage(prompt)];
173
- result = await llm.pipe(parser).invoke(messages);
174
- }
175
- return result;
176
- }
177
- catch (err) {
178
- logger_1.logger.error({ message: 'Extraction failed', err });
179
- if (mergedConfig.defaultValue) {
180
- return mergedConfig.defaultValue;
181
- }
182
- throw err;
183
- }
184
- }
185
- /**
186
- * Create a simple extractor for common use cases
187
- * @param schemaOrPrompt Either a Zod schema or a simple prompt string
188
- * @param options Additional configuration options
189
- * @returns A configured extract function
190
- */
191
- function createExtractor(schemaOrPrompt, options) {
192
- let config;
193
- if (typeof schemaOrPrompt === 'string') {
194
- // Simple prompt-based extraction - create a Zod schema for a single string result
195
- config = {
196
- schema: zod_1.z.object({
197
- result: zod_1.z.string().describe('The extracted result'),
198
- }),
199
- systemPrompt: schemaOrPrompt,
200
- ...options,
201
- };
202
- }
203
- else {
204
- // Schema-based extraction
205
- config = {
206
- schema: schemaOrPrompt,
207
- ...options,
208
- };
209
- }
210
- return (content, llm) => extract(content, config, llm);
211
- }
212
- // Schema for the extraction tool
213
- exports.schema = zod_1.z.object({
214
- content: zod_1.z.string().describe('The content to extract information from'),
215
- schema: zod_1.z.record(zod_1.z.any()).optional().describe('Extraction schema defining the structure of data to extract'),
216
- systemPrompt: zod_1.z.string().optional().describe('Custom system prompt for extraction'),
217
- examples: zod_1.z
218
- .array(zod_1.z.object({
219
- input: zod_1.z.string(),
220
- output: zod_1.z.any(),
221
- }))
222
- .optional()
223
- .describe('Examples to guide the extraction'),
224
- strictMode: zod_1.z.boolean().optional().default(true).describe('Whether to validate the extraction against the schema'),
225
- maxRetries: zod_1.z.number().optional().default(3).describe('Maximum number of retries if validation fails'),
226
- defaultValue: zod_1.z.any().optional().describe('Default value to return if extraction fails'),
227
- });
228
- const extractionTool = {
229
- name: 'minded-extraction',
230
- description: 'Extract structured data from unstructured text using AI. Supports custom Zod schemas, validation, examples, and retries. When strictMode is enabled, uses LLM structured output (if available) for guaranteed schema compliance. Perfect for extracting specific information like country codes, emails, dates, or any custom data structure.',
231
- input: exports.schema,
232
- isGlobal: false,
233
- execute: async ({ input, state, agent }) => {
234
- const { content, schema: inputSchema, systemPrompt, examples, strictMode, maxRetries, defaultValue } = input;
235
- logger_1.logger.info({
236
- message: 'Extracting structured data',
237
- sessionId: state.sessionId,
238
- contentLength: content.length,
239
- hasSchema: !!inputSchema,
240
- });
241
- // Convert input schema to Zod schema if provided
242
- let extractionSchema;
243
- if (inputSchema) {
244
- // Build a Zod schema from the input schema object
245
- const zodShape = {};
246
- for (const [key, value] of Object.entries(inputSchema)) {
247
- if (typeof value === 'object' && value !== null) {
248
- const fieldConfig = value;
249
- let zodType;
250
- // Create appropriate Zod type based on the field configuration
251
- if (fieldConfig.type === 'string') {
252
- zodType = zod_1.z.string();
253
- }
254
- else if (fieldConfig.type === 'number') {
255
- zodType = zod_1.z.number();
256
- }
257
- else if (fieldConfig.type === 'boolean') {
258
- zodType = zod_1.z.boolean();
259
- }
260
- else if (fieldConfig.type === 'array') {
261
- zodType = zod_1.z.array(zod_1.z.any());
262
- }
263
- else if (fieldConfig.type === 'object') {
264
- zodType = zod_1.z.object({});
265
- }
266
- else {
267
- // Default to string if type not specified
268
- zodType = zod_1.z.string();
269
- }
270
- // Add description if available
271
- if (fieldConfig.description) {
272
- zodType = zodType.describe(fieldConfig.description);
273
- }
274
- // Handle optional fields
275
- if (fieldConfig.required === false) {
276
- zodType = zodType.optional();
277
- }
278
- zodShape[key] = zodType;
279
- }
280
- else {
281
- // Default to string for simple values
282
- zodShape[key] = zod_1.z.string();
283
- }
284
- }
285
- extractionSchema = zod_1.z.object(zodShape);
286
- }
287
- else {
288
- // Default schema if none provided
289
- extractionSchema = zod_1.z.object({
290
- result: zod_1.z.string().describe('The extracted result'),
291
- });
292
- }
293
- const config = {
294
- schema: extractionSchema,
295
- systemPrompt,
296
- examples,
297
- strictMode,
298
- maxRetries,
299
- defaultValue,
300
- };
301
- try {
302
- const result = await extract(content, config, agent.llm);
303
- logger_1.logger.info({
304
- message: 'Extraction completed',
305
- sessionId: state.sessionId,
306
- resultKeys: Object.keys(result),
307
- });
308
- state.memory.lastExtraction = {
309
- content: content.substring(0, 100) + (content.length > 100 ? '...' : ''),
310
- result,
311
- timestamp: new Date().toISOString(),
312
- };
313
- return {
314
- result,
315
- };
316
- }
317
- catch (err) {
318
- logger_1.logger.error({
319
- message: 'Extraction failed',
320
- sessionId: state.sessionId,
321
- err,
322
- });
323
- throw err;
324
- }
325
- },
326
- };
327
- exports.default = extractionTool;
328
- //# sourceMappingURL=extraction.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"extraction.js","sourceRoot":"","sources":["../../../src/toolsLibrary/browser/extraction.ts"],"names":[],"mappings":";;;AAuHA,0BAoHC;AAQD,0CAqBC;AAxQD,6BAAwB;AACxB,2DAAqD;AAErD,+CAA4C;AAC5C,mEAAkE;AAClE,uDAAyD;AAQzD,SAAS,wBAAwB,CAAC,GAAsB;IACtD,OAAO,sBAAsB,IAAI,GAAG,IAAI,OAAQ,GAAW,CAAC,oBAAoB,KAAK,UAAU,CAAC;AAClG,CAAC;AAgBD,wBAAwB;AACxB,MAAM,cAAc,GAA8B;IAChD,UAAU,EAAE,CAAC;IACb,UAAU,EAAE,IAAI;CACjB,CAAC;AAEF;;GAEG;AACH,SAAS,kBAAkB,CAAC,MAAwB;IAClD,+CAA+C;IAC/C,MAAM,UAAU,GAAG,IAAA,oCAAe,EAAC,MAAM,EAAE;QACzC,MAAM,EAAE,UAAU;QAClB,YAAY,EAAE,MAAM,EAAE,4CAA4C;KACnE,CAAC,CAAC;IAEH,iDAAiD;IACjD,IAAI,OAAO,UAAU,KAAK,QAAQ,IAAI,UAAU,KAAK,IAAI,IAAI,SAAS,IAAI,UAAU,EAAE,CAAC;QACrF,OAAQ,UAAkB,CAAC,OAAO,CAAC;IACrC,CAAC;IAED,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AAC7C,CAAC;AAED;;GAEG;AACH,SAAS,qBAAqB,CAC5B,UAAkB,EAClB,MAAwB,EACxB,QAA4D,EAC5D,OAAe;IAEf,MAAM,iBAAiB,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC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QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,eAAM,CAAC,KAAK,CAAC;gBACX,OAAO,EAAE,mBAAmB;gBAC5B,SAAS,EAAE,KAAK,CAAC,SAAS;gBAC1B,GAAG;aACJ,CAAC,CAAC;YAEH,MAAM,GAAG,CAAC;QACZ,CAAC;IACH,CAAC;CACF,CAAC;AAEF,kBAAe,cAAc,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from './Agent.types';
2
- //# sourceMappingURL=Agent.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Agent.d.ts","sourceRoot":"","sources":["../../src/types/Agent.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}