@minded-ai/mindedjs 1.0.141 → 1.0.142-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.
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +23 -5
- package/dist/agent.js.map +1 -1
- 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/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/internalTools/timer.d.ts +5 -2
- package/dist/internalTools/timer.d.ts.map +1 -1
- package/dist/internalTools/timer.js +12 -14
- package/dist/internalTools/timer.js.map +1 -1
- package/dist/nodes/addPromptNode.d.ts.map +1 -1
- package/dist/nodes/addPromptNode.js +7 -3
- package/dist/nodes/addPromptNode.js.map +1 -1
- package/package.json +1 -1
- package/src/agent.ts +21 -5
- package/src/internalTools/timer.ts +14 -17
- package/src/nodes/addPromptNode.ts +7 -3
|
@@ -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!"
|
|
@@ -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"}
|
|
@@ -4,10 +4,10 @@ export declare const timerHandlers: Map<string, {
|
|
|
4
4
|
sessionId: string;
|
|
5
5
|
payload: Record<string, any>;
|
|
6
6
|
}) => void | Promise<void>;
|
|
7
|
-
}
|
|
7
|
+
}>;
|
|
8
8
|
/**
|
|
9
9
|
* Reset or set a timer for a specific session.
|
|
10
|
-
* When the timer expires,
|
|
10
|
+
* When the timer expires, the registered timer handler will be called.
|
|
11
11
|
*
|
|
12
12
|
* @param params - The timer configuration
|
|
13
13
|
* @param params.sessionId - The session ID to associate the timer with
|
|
@@ -59,6 +59,9 @@ export declare function cancelTimer(sessionId: string, timerName: string): Promi
|
|
|
59
59
|
* Register a handler for timer trigger events for a specific timer name.
|
|
60
60
|
* The handler will be called when the specified timer expires for any session.
|
|
61
61
|
*
|
|
62
|
+
* Note: Only one handler per timer name is supported. Calling this function multiple times
|
|
63
|
+
* with the same timer name will replace the previous handler.
|
|
64
|
+
*
|
|
62
65
|
* @param params - The configuration for the timer handler
|
|
63
66
|
* @param params.timerName - The name of the timer to handle
|
|
64
67
|
* @param params.handler - Function to call when the timer triggers
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timer.d.ts","sourceRoot":"","sources":["../../src/internalTools/timer.ts"],"names":[],"mappings":"AACA,OAAO,EAAqC,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAG/H,eAAO,MAAM,aAAa;aAGb,CAAC,MAAM,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;KAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"timer.d.ts","sourceRoot":"","sources":["../../src/internalTools/timer.ts"],"names":[],"mappings":"AACA,OAAO,EAAqC,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAG/H,eAAO,MAAM,aAAa;aAGb,CAAC,MAAM,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;KAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;EAE/F,CAAC;AAEJ;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAsB,UAAU,CAAC,EAC/B,SAAS,EACT,OAAO,EACP,SAAS,EACT,OAAY,GACb,EAAE;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC/B,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAO9B;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAQpG;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,OAAO,CAAC,EACtB,SAAS,EACT,OAAO,GACR,EAAE;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,CAAC,MAAM,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;KAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAChG,GAAG,IAAI,CAGP"}
|
|
@@ -29,11 +29,11 @@ exports.cancelTimer = cancelTimer;
|
|
|
29
29
|
exports.onTimer = onTimer;
|
|
30
30
|
const mindedConnection = __importStar(require("../platform/mindedConnection"));
|
|
31
31
|
const mindedConnectionTypes_1 = require("../platform/mindedConnectionTypes");
|
|
32
|
-
// Store timer handlers by timer name
|
|
32
|
+
// Store timer handlers by timer name (one handler per timer name)
|
|
33
33
|
exports.timerHandlers = new Map();
|
|
34
34
|
/**
|
|
35
35
|
* Reset or set a timer for a specific session.
|
|
36
|
-
* When the timer expires,
|
|
36
|
+
* When the timer expires, the registered timer handler will be called.
|
|
37
37
|
*
|
|
38
38
|
* @param params - The timer configuration
|
|
39
39
|
* @param params.sessionId - The session ID to associate the timer with
|
|
@@ -95,6 +95,9 @@ async function cancelTimer(sessionId, timerName) {
|
|
|
95
95
|
* Register a handler for timer trigger events for a specific timer name.
|
|
96
96
|
* The handler will be called when the specified timer expires for any session.
|
|
97
97
|
*
|
|
98
|
+
* Note: Only one handler per timer name is supported. Calling this function multiple times
|
|
99
|
+
* with the same timer name will replace the previous handler.
|
|
100
|
+
*
|
|
98
101
|
* @param params - The configuration for the timer handler
|
|
99
102
|
* @param params.timerName - The name of the timer to handle
|
|
100
103
|
* @param params.handler - Function to call when the timer triggers
|
|
@@ -120,20 +123,15 @@ async function cancelTimer(sessionId, timerName) {
|
|
|
120
123
|
* ```
|
|
121
124
|
*/
|
|
122
125
|
function onTimer({ timerName, handler, }) {
|
|
123
|
-
//
|
|
124
|
-
|
|
125
|
-
exports.timerHandlers.set(timerName, []);
|
|
126
|
-
}
|
|
127
|
-
// Add the handler to the array for this timer name
|
|
128
|
-
const handlers = exports.timerHandlers.get(timerName);
|
|
129
|
-
handlers.push({ handler });
|
|
126
|
+
// Set the handler for this timer name (replaces any existing handler)
|
|
127
|
+
exports.timerHandlers.set(timerName, { handler });
|
|
130
128
|
}
|
|
131
129
|
mindedConnection.on(mindedConnectionTypes_1.mindedConnectionSocketMessageType.TIMER_TRIGGER, async (timerTriggerMessage) => {
|
|
132
|
-
// Get
|
|
133
|
-
const
|
|
134
|
-
// Call
|
|
135
|
-
|
|
136
|
-
await handler({
|
|
130
|
+
// Get handler for the specific timer name
|
|
131
|
+
const handlerEntry = exports.timerHandlers.get(timerTriggerMessage.timerName);
|
|
132
|
+
// Call the handler if it exists
|
|
133
|
+
if (handlerEntry) {
|
|
134
|
+
await handlerEntry.handler({
|
|
137
135
|
sessionId: timerTriggerMessage.sessionId,
|
|
138
136
|
payload: timerTriggerMessage.eventArgs,
|
|
139
137
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timer.js","sourceRoot":"","sources":["../../src/internalTools/timer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,gCAiBC;AAkBD,kCAQC;
|
|
1
|
+
{"version":3,"file":"timer.js","sourceRoot":"","sources":["../../src/internalTools/timer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,gCAiBC;AAkBD,kCAQC;AAiCD,0BASC;AA3HD,+EAAiE;AACjE,6EAA+H;AAE/H,kEAAkE;AACrD,QAAA,aAAa,GAAG,IAAI,GAAG,EAKjC,CAAC;AAEJ;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACI,KAAK,UAAU,UAAU,CAAC,EAC/B,SAAS,EACT,OAAO,EACP,SAAS,EACT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AAE,UAAU,CAAC;IACjB,GAAG,EAAE,iBAAiB,CAAC;IACvB,KAAK,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;IACxB,IAAI,EAAE,aAAa,CAAC,GAAG,EAAE,MAAM,yBAAyB,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/D,KAAK,EAAE,KAAK,CAAC;CACd,CAAC;AAEF,eAAO,MAAM,aAAa,6CAAoD,mBAAmB,kBA+IhG,CAAC"}
|
|
@@ -122,12 +122,16 @@ const addPromptNode = async ({ graph, node, llm, tools, emit, agent }) => {
|
|
|
122
122
|
],
|
|
123
123
|
};
|
|
124
124
|
}
|
|
125
|
+
// Model text response
|
|
125
126
|
state.goto = null;
|
|
126
|
-
state
|
|
127
|
-
|
|
127
|
+
//update state so AI_MESSAGE will get the latest state
|
|
128
|
+
const stateForAIMessage = structuredClone(state);
|
|
129
|
+
stateForAIMessage.goto = null;
|
|
130
|
+
stateForAIMessage.messages.push(result);
|
|
131
|
+
let stateUpdate = { goto: null, messages: [result] };
|
|
128
132
|
if (result.getType() === 'ai') {
|
|
129
133
|
logger_1.logger.info({ msg: `[Model] Response`, content: result.content });
|
|
130
|
-
const results = await emit(AgentEvents_1.AgentEvents.AI_MESSAGE, { message: result.content, state });
|
|
134
|
+
const results = await emit(AgentEvents_1.AgentEvents.AI_MESSAGE, { message: result.content, state: stateForAIMessage });
|
|
131
135
|
const handlerResult = results.find((r) => r !== undefined);
|
|
132
136
|
if (handlerResult && handlerResult.state) {
|
|
133
137
|
stateUpdate = { ...stateUpdate, ...handlerResult.state };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addPromptNode.js","sourceRoot":"","sources":["../../src/nodes/addPromptNode.ts"],"names":[],"mappings":";;;;;;AACA,sDAA4D;AAI5D,uDAAiF;AAEjF,iDAA8D;AAC9D,uDAA+E;AAE/E,gEAA6D;AAC7D,qGAA2E;AAE3E,4CAAyC;AACzC,sDAA0D;AAC1D,8C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CAAC,CAAC;IAEH,OAAO;;;;;;;;sBAQa,IAAI,CAAC,WAAW;;;EAGpC,IAAI,CAAC,MAAM;;;;;;;;;;;;EAYX,SAAS,EAAE,CAAC;AACd,CAAC"}
|
package/package.json
CHANGED
package/src/agent.ts
CHANGED
|
@@ -839,11 +839,27 @@ export class Agent {
|
|
|
839
839
|
To be used by the Lambda wrapper to trigger timers
|
|
840
840
|
*/
|
|
841
841
|
public async timerTrigger(params: { sessionId: string; timerName: string; eventArgs: Record<string, any> }): Promise<void> {
|
|
842
|
-
const
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
842
|
+
const handlerEntry = timerHandlers.get(params.timerName);
|
|
843
|
+
if (handlerEntry) {
|
|
844
|
+
try {
|
|
845
|
+
await handlerEntry.handler({
|
|
846
|
+
sessionId: params.sessionId,
|
|
847
|
+
payload: params.eventArgs,
|
|
848
|
+
});
|
|
849
|
+
} catch (error) {
|
|
850
|
+
logger.error({
|
|
851
|
+
message: '[Timer] Error executing timer handler',
|
|
852
|
+
timerName: params.timerName,
|
|
853
|
+
sessionId: params.sessionId,
|
|
854
|
+
error: error instanceof Error ? error.message : error,
|
|
855
|
+
});
|
|
856
|
+
throw error;
|
|
857
|
+
}
|
|
858
|
+
} else {
|
|
859
|
+
logger.warn({
|
|
860
|
+
message: '[Timer] No handler found for timer',
|
|
861
|
+
timerName: params.timerName,
|
|
862
|
+
registeredTimers: Array.from(timerHandlers.keys()),
|
|
847
863
|
});
|
|
848
864
|
}
|
|
849
865
|
}
|