@minded-ai/mindedjs 2.0.13 ā 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.
- package/dist/browserTask/README.md +419 -0
- package/dist/browserTask/browserAgent.py +632 -0
- package/dist/browserTask/captcha_isolated.png +0 -0
- package/dist/browserTask/executeBrowserTask.ts +79 -0
- package/dist/browserTask/requirements.txt +8 -0
- package/dist/browserTask/setup.sh +144 -0
- package/dist/cli/index.js +0 -0
- package/dist/internalTools/retell.d.ts +12 -0
- package/dist/internalTools/retell.d.ts.map +1 -0
- package/dist/internalTools/retell.js +54 -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 +61 -0
- package/dist/internalTools/sendPlaceholderMessage.js.map +1 -0
- package/dist/toolsLibrary/classifier.d.ts.map +1 -1
- package/dist/toolsLibrary/classifier.js +103 -33
- package/dist/toolsLibrary/classifier.js.map +1 -1
- package/dist/utils/extractStateMemoryResponse.d.ts +5 -0
- package/dist/utils/extractStateMemoryResponse.d.ts.map +1 -0
- package/dist/utils/extractStateMemoryResponse.js +91 -0
- package/dist/utils/extractStateMemoryResponse.js.map +1 -0
- package/package.json +2 -2
- package/src/toolsLibrary/classifier.ts +115 -37
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { spawn } from 'child_process';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
import { logger } from '../utils/logger';
|
|
4
|
+
|
|
5
|
+
export const executeBrowserTask = async (prompt: string): Promise<string> => {
|
|
6
|
+
const pythonScriptPath = join(__dirname, 'browserAgent.py');
|
|
7
|
+
const venvPythonPath = join(__dirname, '.venv', 'bin', 'python');
|
|
8
|
+
|
|
9
|
+
return new Promise((resolve, reject) => {
|
|
10
|
+
// Determine which Python to use - prefer venv if it exists
|
|
11
|
+
const fs = require('fs');
|
|
12
|
+
const pythonCommand = fs.existsSync(venvPythonPath) ? venvPythonPath : 'python3';
|
|
13
|
+
|
|
14
|
+
// Use Python to run our browser agent script with CAPTCHA bypass
|
|
15
|
+
const child = spawn(pythonCommand, [pythonScriptPath, '-p', prompt, '--output-format', 'json'], {
|
|
16
|
+
env: {
|
|
17
|
+
...process.env,
|
|
18
|
+
// Ensure Python can find the script and dependencies
|
|
19
|
+
PYTHONPATH: __dirname,
|
|
20
|
+
// Set virtual environment if it exists
|
|
21
|
+
VIRTUAL_ENV: fs.existsSync(join(__dirname, '.venv')) ? join(__dirname, '.venv') : undefined,
|
|
22
|
+
},
|
|
23
|
+
cwd: __dirname,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
let output = '';
|
|
27
|
+
let errorOutput = '';
|
|
28
|
+
|
|
29
|
+
// Stream stdout to console and collect it
|
|
30
|
+
child.stdout.on('data', (data) => {
|
|
31
|
+
const chunk = data.toString();
|
|
32
|
+
logger.trace({ message: 'Browser task output', output: chunk });
|
|
33
|
+
output += chunk;
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
// Stream stderr to console and collect errors
|
|
37
|
+
child.stderr.on('data', (data) => {
|
|
38
|
+
const chunk = data.toString();
|
|
39
|
+
logger.error({ message: 'Browser task error', error: chunk });
|
|
40
|
+
errorOutput += chunk;
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
child.on('error', (error) => {
|
|
44
|
+
logger.error({ message: 'Failed to start browser task process', error: error.message });
|
|
45
|
+
reject(new Error(`Failed to start browser task: ${error.message}`));
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
child.on('close', (code) => {
|
|
49
|
+
if (code !== 0) {
|
|
50
|
+
logger.error({
|
|
51
|
+
message: 'Browser task process exited with error',
|
|
52
|
+
code,
|
|
53
|
+
stderr: errorOutput,
|
|
54
|
+
});
|
|
55
|
+
reject(new Error(`Browser task failed with code ${code}: ${errorOutput}`));
|
|
56
|
+
} else {
|
|
57
|
+
try {
|
|
58
|
+
// Parse JSON output from Python script
|
|
59
|
+
const result = JSON.parse(output.trim());
|
|
60
|
+
if (result.success) {
|
|
61
|
+
logger.info({ message: 'Browser task completed successfully' });
|
|
62
|
+
resolve(result.result || 'Task completed successfully');
|
|
63
|
+
} else {
|
|
64
|
+
logger.error({ message: 'Browser task failed', error: result.error });
|
|
65
|
+
reject(new Error(result.error || 'Unknown error occurred'));
|
|
66
|
+
}
|
|
67
|
+
} catch (parseError) {
|
|
68
|
+
// Fallback to plain text output if JSON parsing fails
|
|
69
|
+
logger.warn({
|
|
70
|
+
message: 'Could not parse JSON output, using plain text',
|
|
71
|
+
output: output.trim(),
|
|
72
|
+
});
|
|
73
|
+
resolve(output.trim() || 'Task completed');
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Browser Agent Setup Script
|
|
4
|
+
# This script sets up the Python environment for the browser agent with CAPTCHA bypass
|
|
5
|
+
|
|
6
|
+
set -e
|
|
7
|
+
|
|
8
|
+
echo "š Setting up Browser Agent with CAPTCHA Bypass..."
|
|
9
|
+
|
|
10
|
+
# Get the directory where this script is located
|
|
11
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
12
|
+
cd "$SCRIPT_DIR"
|
|
13
|
+
|
|
14
|
+
# Check if Python 3 is installed
|
|
15
|
+
if ! command -v python3 &> /dev/null; then
|
|
16
|
+
echo "ā Python 3 is not installed. Please install Python 3.11 or higher."
|
|
17
|
+
exit 1
|
|
18
|
+
fi
|
|
19
|
+
|
|
20
|
+
# Check Python version - browser-use requires Python 3.11+
|
|
21
|
+
PYTHON_VERSION=$(python3 -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')
|
|
22
|
+
PYTHON_MAJOR=$(echo $PYTHON_VERSION | cut -d. -f1)
|
|
23
|
+
PYTHON_MINOR=$(echo $PYTHON_VERSION | cut -d. -f2)
|
|
24
|
+
|
|
25
|
+
if [ "$PYTHON_MAJOR" -lt 3 ] || { [ "$PYTHON_MAJOR" -eq 3 ] && [ "$PYTHON_MINOR" -lt 11 ]; }; then
|
|
26
|
+
echo "ā Python 3.11 or higher is required for browser-use. Found Python $PYTHON_VERSION"
|
|
27
|
+
echo "š” Please install Python 3.11+ or use a version manager like pyenv:"
|
|
28
|
+
echo " # Install pyenv (if not installed)"
|
|
29
|
+
echo " curl https://pyenv.run | bash"
|
|
30
|
+
echo " # Install and use Python 3.12"
|
|
31
|
+
echo " pyenv install 3.12.0"
|
|
32
|
+
echo " pyenv local 3.12.0"
|
|
33
|
+
exit 1
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
echo "ā
Python $PYTHON_VERSION detected"
|
|
37
|
+
|
|
38
|
+
# Check if uv is installed
|
|
39
|
+
if ! command -v uv &> /dev/null; then
|
|
40
|
+
echo "ā ļø uv is not installed. Installing uv..."
|
|
41
|
+
# Install uv
|
|
42
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
43
|
+
|
|
44
|
+
# Source the shell to get uv in PATH
|
|
45
|
+
export PATH="$HOME/.cargo/bin:$PATH"
|
|
46
|
+
|
|
47
|
+
# Verify installation
|
|
48
|
+
if ! command -v uv &> /dev/null; then
|
|
49
|
+
echo "ā Failed to install uv. Please install manually:"
|
|
50
|
+
echo " curl -LsSf https://astral.sh/uv/install.sh | sh"
|
|
51
|
+
exit 1
|
|
52
|
+
fi
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
echo "ā
uv detected"
|
|
56
|
+
|
|
57
|
+
echo "š Setting up Python environment with uv..."
|
|
58
|
+
|
|
59
|
+
# Create virtual environment with uv (if not exists)
|
|
60
|
+
if [ ! -d ".venv" ]; then
|
|
61
|
+
echo "š Creating virtual environment..."
|
|
62
|
+
|
|
63
|
+
# Try Python 3.12 first, then fall back to 3.11
|
|
64
|
+
if uv venv --python 3.12 2>/dev/null; then
|
|
65
|
+
echo "ā
Created virtual environment with Python 3.12"
|
|
66
|
+
elif uv venv --python 3.11 2>/dev/null; then
|
|
67
|
+
echo "ā
Created virtual environment with Python 3.11"
|
|
68
|
+
else
|
|
69
|
+
echo "ā Failed to create virtual environment with Python 3.11+. Please check your Python installation."
|
|
70
|
+
exit 1
|
|
71
|
+
fi
|
|
72
|
+
else
|
|
73
|
+
echo "ā
Virtual environment already exists"
|
|
74
|
+
fi
|
|
75
|
+
|
|
76
|
+
echo "š¦ Installing Python dependencies with uv..."
|
|
77
|
+
|
|
78
|
+
# Install Python dependencies using uv
|
|
79
|
+
uv pip install -r requirements.txt
|
|
80
|
+
|
|
81
|
+
# Install playwright browsers
|
|
82
|
+
echo "š Installing Playwright browsers..."
|
|
83
|
+
uv run playwright install
|
|
84
|
+
|
|
85
|
+
# Check if tesseract is installed (required for OCR)
|
|
86
|
+
if ! command -v tesseract &> /dev/null; then
|
|
87
|
+
echo "ā ļø Tesseract OCR is not installed. Installing..."
|
|
88
|
+
|
|
89
|
+
# Detect OS and install tesseract
|
|
90
|
+
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
|
91
|
+
# Linux
|
|
92
|
+
if command -v apt-get &> /dev/null; then
|
|
93
|
+
sudo apt-get update
|
|
94
|
+
sudo apt-get install -y tesseract-ocr tesseract-ocr-eng
|
|
95
|
+
elif command -v yum &> /dev/null; then
|
|
96
|
+
sudo yum install -y tesseract tesseract-langpack-eng
|
|
97
|
+
elif command -v dnf &> /dev/null; then
|
|
98
|
+
sudo dnf install -y tesseract tesseract-langpack-eng
|
|
99
|
+
else
|
|
100
|
+
echo "ā Could not install tesseract automatically. Please install it manually."
|
|
101
|
+
echo " For Ubuntu/Debian: sudo apt-get install tesseract-ocr"
|
|
102
|
+
echo " For CentOS/RHEL: sudo yum install tesseract"
|
|
103
|
+
fi
|
|
104
|
+
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
|
105
|
+
# macOS
|
|
106
|
+
if command -v brew &> /dev/null; then
|
|
107
|
+
brew install tesseract
|
|
108
|
+
else
|
|
109
|
+
echo "ā Homebrew not found. Please install tesseract manually:"
|
|
110
|
+
echo " brew install tesseract"
|
|
111
|
+
exit 1
|
|
112
|
+
fi
|
|
113
|
+
else
|
|
114
|
+
echo "ā Unsupported OS. Please install tesseract manually."
|
|
115
|
+
exit 1
|
|
116
|
+
fi
|
|
117
|
+
fi
|
|
118
|
+
|
|
119
|
+
# Verify tesseract installation
|
|
120
|
+
if command -v tesseract &> /dev/null; then
|
|
121
|
+
TESSERACT_VERSION=$(tesseract --version | head -n1)
|
|
122
|
+
echo "ā
$TESSERACT_VERSION detected"
|
|
123
|
+
else
|
|
124
|
+
echo "ā Tesseract installation failed or not found in PATH"
|
|
125
|
+
exit 1
|
|
126
|
+
fi
|
|
127
|
+
|
|
128
|
+
# Make the Python script executable
|
|
129
|
+
chmod +x browserAgent.py
|
|
130
|
+
|
|
131
|
+
echo "š Setup completed successfully!"
|
|
132
|
+
echo ""
|
|
133
|
+
echo "š Next steps:"
|
|
134
|
+
echo "1. Activate the virtual environment:"
|
|
135
|
+
echo " source .venv/bin/activate"
|
|
136
|
+
echo ""
|
|
137
|
+
echo "2. Set your OpenAI API key in environment variables:"
|
|
138
|
+
echo " export OPENAI_API_KEY='your-api-key-here'"
|
|
139
|
+
echo ""
|
|
140
|
+
echo "3. Test the browser agent:"
|
|
141
|
+
echo " uv run python browserAgent.py -p 'Navigate to google.com and search for browser automation'"
|
|
142
|
+
echo " # Or with activated venv: python browserAgent.py -p 'Navigate to google.com'"
|
|
143
|
+
echo ""
|
|
144
|
+
echo "⨠The browser agent is now ready with CAPTCHA bypass capabilities!"
|
package/dist/cli/index.js
CHANGED
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TimerResetResponse, RetellGetCallResponse } from '../platform/mindedConnectionTypes';
|
|
2
|
+
export declare function retellCall({ sessionId, callName, callAgentId, vars, }: {
|
|
3
|
+
sessionId: string;
|
|
4
|
+
callName: string;
|
|
5
|
+
callAgentId: string;
|
|
6
|
+
vars?: Record<string, any>;
|
|
7
|
+
}): Promise<TimerResetResponse>;
|
|
8
|
+
export declare function retellGetCall({ sessionId, callId }: {
|
|
9
|
+
sessionId: string;
|
|
10
|
+
callId: string;
|
|
11
|
+
}): Promise<RetellGetCallResponse>;
|
|
12
|
+
//# sourceMappingURL=retell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retell.d.ts","sourceRoot":"","sources":["../../src/internalTools/retell.ts"],"names":[],"mappings":"AACA,OAAO,EAAqC,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAEjI,wBAAsB,UAAU,CAAC,EAC/B,SAAS,EACT,QAAQ,EACR,WAAW,EACX,IAAS,GACV,EAAE;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC5B,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAO9B;AAED,wBAAsB,aAAa,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAKhI"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.retellCall = retellCall;
|
|
37
|
+
exports.retellGetCall = retellGetCall;
|
|
38
|
+
const mindedConnection = __importStar(require("../platform/mindedConnection"));
|
|
39
|
+
const mindedConnectionTypes_1 = require("../platform/mindedConnectionTypes");
|
|
40
|
+
async function retellCall({ sessionId, callName, callAgentId, vars = {}, }) {
|
|
41
|
+
return await mindedConnection.awaitEmit(mindedConnectionTypes_1.mindedConnectionSocketMessageType.RETELL_CALL, {
|
|
42
|
+
sessionId,
|
|
43
|
+
callName,
|
|
44
|
+
callAgentId,
|
|
45
|
+
vars,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
async function retellGetCall({ sessionId, callId }) {
|
|
49
|
+
return await mindedConnection.awaitEmit(mindedConnectionTypes_1.mindedConnectionSocketMessageType.RETELL_GET_CALL, {
|
|
50
|
+
sessionId,
|
|
51
|
+
callId,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=retell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retell.js","sourceRoot":"","sources":["../../src/internalTools/retell.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,gCAiBC;AAED,sCAKC;AA3BD,+EAAiE;AACjE,6EAAiI;AAE1H,KAAK,UAAU,UAAU,CAAC,EAC/B,SAAS,EACT,QAAQ,EACR,WAAW,EACX,IAAI,GAAG,EAAE,GAMV;IACC,OAAO,MAAM,gBAAgB,CAAC,SAAS,CAAC,yDAAiC,CAAC,WAAW,EAAE;QACrF,SAAS;QACT,QAAQ;QACR,WAAW;QACX,IAAI;KACL,CAAC,CAAC;AACL,CAAC;AAEM,KAAK,UAAU,aAAa,CAAC,EAAE,SAAS,EAAE,MAAM,EAAyC;IAC9F,OAAO,MAAM,gBAAgB,CAAC,SAAS,CAAC,yDAAiC,CAAC,eAAe,EAAE;QACzF,SAAS;QACT,MAAM;KACP,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Send a placeholder message to the dashboard voice session.
|
|
3
|
+
* This is typically used for voice sessions to provide immediate feedback to users.
|
|
4
|
+
*
|
|
5
|
+
* @param params - The parameters for sending the placeholder message
|
|
6
|
+
* @param params.sessionId - The session ID of the voice session
|
|
7
|
+
* @param params.message - The placeholder message to send
|
|
8
|
+
* @throws {Error} When the Minded connection is not established
|
|
9
|
+
*/
|
|
10
|
+
export declare function sendPlaceholderMessage(params: {
|
|
11
|
+
sessionId: string;
|
|
12
|
+
message: string;
|
|
13
|
+
}): Promise<void>;
|
|
14
|
+
//# sourceMappingURL=sendPlaceholderMessage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sendPlaceholderMessage.d.ts","sourceRoot":"","sources":["../../src/internalTools/sendPlaceholderMessage.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,wBAAsB,sBAAsB,CAAC,MAAM,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAc1G"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.sendPlaceholderMessage = sendPlaceholderMessage;
|
|
37
|
+
const mindedConnection = __importStar(require("../platform/mindedConnection"));
|
|
38
|
+
const mindedConnectionTypes_1 = require("../platform/mindedConnectionTypes");
|
|
39
|
+
/**
|
|
40
|
+
* Send a placeholder message to the dashboard voice session.
|
|
41
|
+
* This is typically used for voice sessions to provide immediate feedback to users.
|
|
42
|
+
*
|
|
43
|
+
* @param params - The parameters for sending the placeholder message
|
|
44
|
+
* @param params.sessionId - The session ID of the voice session
|
|
45
|
+
* @param params.message - The placeholder message to send
|
|
46
|
+
* @throws {Error} When the Minded connection is not established
|
|
47
|
+
*/
|
|
48
|
+
async function sendPlaceholderMessage(params) {
|
|
49
|
+
const { sessionId, message } = params;
|
|
50
|
+
if (!mindedConnection.isConnected()) {
|
|
51
|
+
throw new Error('Minded connection is not established when trying to send placeholder message');
|
|
52
|
+
}
|
|
53
|
+
const connection = mindedConnection;
|
|
54
|
+
connection.emit(mindedConnectionTypes_1.mindedConnectionSocketMessageType.VOICE_PLACEHOLDER_MESSAGES, {
|
|
55
|
+
sessionId,
|
|
56
|
+
message,
|
|
57
|
+
timestamp: Date.now(),
|
|
58
|
+
type: mindedConnectionTypes_1.mindedConnectionSocketMessageType.VOICE_PLACEHOLDER_MESSAGES,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=sendPlaceholderMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sendPlaceholderMessage.js","sourceRoot":"","sources":["../../src/internalTools/sendPlaceholderMessage.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,wDAcC;AA1BD,+EAAiE;AACjE,6EAAsF;AAEtF;;;;;;;;GAQG;AACI,KAAK,UAAU,sBAAsB,CAAC,MAA8C;IACzF,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IAEtC,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CAAC,8EAA8E,CAAC,CAAC;IAClG,CAAC;IAED,MAAM,UAAU,GAAG,gBAAgB,CAAC;IACpC,UAAU,CAAC,IAAI,CAAC,yDAAiC,CAAC,0BAA0B,EAAE;QAC5E,SAAS;QACT,OAAO;QACP,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;QACrB,IAAI,EAAE,yDAAiC,CAAC,0BAA0B;KACnE,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"classifier.d.ts","sourceRoot":"","sources":["../../src/toolsLibrary/classifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAI5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAGzE,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,oBAAoB;IACnC,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AAgB,CAAC,aAazF,MAAM,OAAO,iBAAiB,mCAChD;AAGD,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoBjB,CAAC;AAEH,QAAA,MAAM,cAAc,EAAE,IAAI,CAAC,OAAO,MAAM,EAAE,GAAG,CA6E5C,CAAC;AAEF,eAAe,cAAc,CAAC;AAG9B,wBAAsB,aAAa,CACjC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,gBAAgB,GAAG;IAAE,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,EAClD,GAAG,EAAE,iBAAiB,GACrB,OAAO,CAAC,oBAAoB,EAAE,CAAC,CA6CjC"}
|
|
@@ -15,6 +15,30 @@ const DEFAULT_CONFIG = {
|
|
|
15
15
|
defaultClass: 'unknown',
|
|
16
16
|
defaultReason: 'Unable to determine classification',
|
|
17
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* Validates the classification result
|
|
20
|
+
* @param result The classification result to validate
|
|
21
|
+
* @param config The classifier configuration
|
|
22
|
+
* @returns True if the result is valid, false otherwise
|
|
23
|
+
*/
|
|
24
|
+
function validateClassificationResult(result, config) {
|
|
25
|
+
// Check if result exists and has a class property
|
|
26
|
+
if (!result || !result.class) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
// Check if the class is one of the configured classes
|
|
30
|
+
const validClasses = config.classes.map((c) => c.name);
|
|
31
|
+
if (!validClasses.includes(result.class)) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
// If we expect JSON format with confidence, validate it
|
|
35
|
+
if (config.outputFormat === 'json' && result.confidence !== undefined) {
|
|
36
|
+
if (typeof result.confidence !== 'number' || result.confidence < 0 || result.confidence > 1) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
18
42
|
/**
|
|
19
43
|
* Generic classifier utility that can be used standalone
|
|
20
44
|
* @param content The content to classify
|
|
@@ -24,43 +48,89 @@ const DEFAULT_CONFIG = {
|
|
|
24
48
|
*/
|
|
25
49
|
async function classify(content, config, llm) {
|
|
26
50
|
const mergedConfig = { ...DEFAULT_CONFIG, ...config };
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
51
|
+
const MAX_RETRIES = 3;
|
|
52
|
+
let lastError = null;
|
|
53
|
+
let lastInvalidResult = null;
|
|
54
|
+
for (let attempt = 1; attempt <= MAX_RETRIES; attempt++) {
|
|
55
|
+
try {
|
|
56
|
+
// Build the classification prompt
|
|
57
|
+
const classesDescription = mergedConfig.classes.map((c) => `${c.name}: ${c.description}`).join('\n');
|
|
58
|
+
const validClassNames = mergedConfig.classes.map((c) => c.name);
|
|
59
|
+
const basePrompt = mergedConfig.systemPrompt ||
|
|
60
|
+
'You are a classifier. Your task is to classify the given content into one of the following categories:';
|
|
61
|
+
let prompt = `${basePrompt}\n\n${classesDescription}\n\n`;
|
|
62
|
+
// Add retry feedback if this is not the first attempt
|
|
63
|
+
if (attempt > 1 && lastInvalidResult) {
|
|
64
|
+
prompt += `\nā ļø IMPORTANT: Your previous classification attempt was INVALID. `;
|
|
65
|
+
if (lastInvalidResult.class && !validClassNames.includes(lastInvalidResult.class)) {
|
|
66
|
+
prompt += `You selected "${lastInvalidResult.class}" which is NOT in the list of valid classes. `;
|
|
67
|
+
}
|
|
68
|
+
else if (!lastInvalidResult.class) {
|
|
69
|
+
prompt += `You did not provide a class value. `;
|
|
70
|
+
}
|
|
71
|
+
prompt += `You MUST select ONLY from these valid classes:\n${validClassNames.join(', ')}\n\n`;
|
|
72
|
+
}
|
|
73
|
+
if (mergedConfig.outputFormat === 'json') {
|
|
74
|
+
prompt += `You should output the result in the following JSON format: {
|
|
75
|
+
"class": "<selected class name>",
|
|
76
|
+
${mergedConfig.includeReason ? '"reason": "<explanation for the classification>",' : ''}
|
|
77
|
+
"confidence": <confidence score between 0 and 1>
|
|
78
|
+
}.\nReturn JSON and nothing more.`;
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
prompt += 'Return only the class name.';
|
|
82
|
+
}
|
|
83
|
+
prompt += `\n\nContent to classify:\n${content}`;
|
|
84
|
+
// Make the classification request
|
|
85
|
+
let result;
|
|
86
|
+
if (mergedConfig.outputFormat === 'json') {
|
|
87
|
+
const parser = new output_parsers_1.JsonOutputParser();
|
|
88
|
+
const parsedResult = await llm.pipe(parser).invoke([new messages_1.SystemMessage(prompt)]);
|
|
89
|
+
result = parsedResult;
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
const llmResult = await llm.invoke([new messages_1.SystemMessage(prompt)]);
|
|
93
|
+
const classText = typeof llmResult.content === 'string' ? llmResult.content.trim() : '';
|
|
94
|
+
result = { class: classText };
|
|
95
|
+
}
|
|
96
|
+
// Validate the result
|
|
97
|
+
if (!validateClassificationResult(result, mergedConfig)) {
|
|
98
|
+
lastInvalidResult = result;
|
|
99
|
+
throw new Error(`Invalid classification result: ${JSON.stringify(result)}`);
|
|
100
|
+
}
|
|
101
|
+
// Success - return the valid result
|
|
47
102
|
return result;
|
|
48
103
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
104
|
+
catch (err) {
|
|
105
|
+
lastError = err;
|
|
106
|
+
logger_1.logger.warn({
|
|
107
|
+
message: `Classification attempt ${attempt} failed`,
|
|
108
|
+
attempt,
|
|
109
|
+
maxRetries: MAX_RETRIES,
|
|
110
|
+
error: lastError.message,
|
|
111
|
+
invalidResult: lastInvalidResult,
|
|
112
|
+
});
|
|
113
|
+
// If this is not the last attempt, continue to retry
|
|
114
|
+
if (attempt < MAX_RETRIES) {
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
53
117
|
}
|
|
54
118
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
119
|
+
// All retries exhausted - fallback to default
|
|
120
|
+
logger_1.logger.warn({
|
|
121
|
+
message: 'Classification failed after max retries, using default class',
|
|
122
|
+
maxRetries: MAX_RETRIES,
|
|
123
|
+
lastError: lastError === null || lastError === void 0 ? void 0 : lastError.message,
|
|
124
|
+
lastInvalidResult,
|
|
125
|
+
defaultClass: mergedConfig.defaultClass,
|
|
126
|
+
defaultReason: mergedConfig.defaultReason,
|
|
127
|
+
});
|
|
128
|
+
// Return default classification
|
|
129
|
+
return {
|
|
130
|
+
class: mergedConfig.defaultClass || 'unknown',
|
|
131
|
+
reason: mergedConfig.defaultReason || `Classification failed after ${MAX_RETRIES} attempts: ${lastError === null || lastError === void 0 ? void 0 : lastError.message}`,
|
|
132
|
+
confidence: 0,
|
|
133
|
+
};
|
|
64
134
|
}
|
|
65
135
|
/**
|
|
66
136
|
* Create a classifier from a simple class list
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"classifier.js","sourceRoot":"","sources":["../../src/toolsLibrary/classifier.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"classifier.js","sourceRoot":"","sources":["../../src/toolsLibrary/classifier.ts"],"names":[],"mappings":";;;AAwEA,4BA8FC;AAQD,4CAcC;AA2GD,sCAiDC;AAxVD,6BAAwB;AAExB,4CAAyC;AACzC,mEAAkE;AAClE,uDAAyD;AAyBzD,wBAAwB;AACxB,MAAM,cAAc,GAA8B;IAChD,YAAY,EAAE,MAAM;IACpB,aAAa,EAAE,IAAI;IACnB,YAAY,EAAE,SAAS;IACvB,aAAa,EAAE,oCAAoC;CACpD,CAAC;AAEF;;;;;GAKG;AACH,SAAS,4BAA4B,CAAC,MAA4B,EAAE,MAAwB;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C,IAAI,CAAC,IAAI,CAAC,CAAC;QAErG,MAAM,UAAU,GACd,YAAY,CAAC,YAAY,IAAI,2FAA2F,CAAC;QAE3H,MAAM,MAAM,GAAG,GAAG,UAAU,OAAO,kBAAkB;wDACD,UAAU;;;;MAI5D,YAAY,CAAC,aAAa,CAAC,CAAC,CAAC,4BAA4B,CAAC,CAAC,CAAC,EAAE;;;;;;;;EAQlE,OAAO,EAAE,CAAC;QAER,MAAM,MAAM,GAAG,IAAI,iCAAgB,EAAE,CAAC;QACtC,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,wBAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAE1E,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YAC1B,OAAO,MAAgC,CAAC;QAC1C,CAAC;QAED,2CAA2C;QAC3C,OAAO,CAAC,MAA8B,CAAC,CAAC;IAC1C,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,eAAM,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,6BAA6B,EAAE,GAAG,EAAE,CAAC,CAAC;QAE9D,OAAO;YACL;gBACE,KAAK,EAAE,YAAY,CAAC,YAAY,IAAI,SAAS;gBAC7C,MAAM,EAAE,YAAY,CAAC,aAAa,IAAK,GAAa,CAAC,OAAO;gBAC5D,UAAU,EAAE,CAAC;aACd;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ToolMessage } from '@langchain/core/messages';
|
|
2
|
+
import { State } from '../types/LangGraph.types';
|
|
3
|
+
declare const extractToolStateResponse: (toolMessage: ToolMessage) => Partial<State>;
|
|
4
|
+
export default extractToolStateResponse;
|
|
5
|
+
//# sourceMappingURL=extractStateMemoryResponse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractStateMemoryResponse.d.ts","sourceRoot":"","sources":["../../src/utils/extractStateMemoryResponse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAA0C,MAAM,0BAA0B,CAAC;AAE5G,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAEjD,QAAA,MAAM,wBAAwB,gBAAiB,WAAW,KAAG,OAAO,CAAC,KAAK,CAazE,CAAC;AA4EF,eAAe,wBAAwB,CAAC"}
|