@minded-ai/mindedjs 1.0.122-beta-1 → 1.0.122-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 +1 -4
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +30 -76
- package/dist/agent.js.map +1 -1
- package/dist/browserTask/executeBrowserTask.d.ts.map +1 -1
- package/dist/checkpointer/checkpointSaverFactory.js +17 -7
- package/dist/checkpointer/checkpointSaverFactory.js.map +1 -1
- package/dist/cli/index.js +31 -21
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/lambdaHandlerTemplate.d.ts.map +1 -1
- package/dist/edges/createDirectEdge.d.ts.map +1 -1
- package/dist/edges/createLogicalRouter.d.ts.map +1 -1
- package/dist/edges/createLogicalRouter.js +17 -7
- package/dist/edges/createLogicalRouter.js.map +1 -1
- package/dist/edges/createPromptRouter.d.ts.map +1 -1
- package/dist/edges/edgeFactory.d.ts.map +1 -1
- package/dist/edges/edgeFactory.js +2 -2
- package/dist/edges/edgeFactory.js.map +1 -1
- package/dist/guidelines/guidelinesManager.d.ts +37 -0
- package/dist/guidelines/guidelinesManager.d.ts.map +1 -0
- package/dist/guidelines/guidelinesManager.js +172 -0
- package/dist/guidelines/guidelinesManager.js.map +1 -0
- package/dist/index.js +17 -7
- package/dist/index.js.map +1 -1
- package/dist/interfaces/zendesk.js +17 -7
- package/dist/interfaces/zendesk.js.map +1 -1
- package/dist/internalTools/appActionRunnerTool.d.ts.map +1 -1
- package/dist/internalTools/appActionRunnerTool.js +17 -7
- package/dist/internalTools/appActionRunnerTool.js.map +1 -1
- package/dist/internalTools/documentExtraction/documentExtraction.js +17 -7
- package/dist/internalTools/documentExtraction/documentExtraction.js.map +1 -1
- package/dist/internalTools/libraryActionRunnerTool.d.ts.map +1 -1
- package/dist/internalTools/timer.js +17 -7
- package/dist/internalTools/timer.js.map +1 -1
- package/dist/internalTools/voice/escalateVoiceCall.d.ts.map +1 -1
- package/dist/internalTools/voice/escalateVoiceCall.js +17 -7
- package/dist/internalTools/voice/escalateVoiceCall.js.map +1 -1
- package/dist/internalTools/voice/retell.js +17 -7
- package/dist/internalTools/voice/retell.js.map +1 -1
- package/dist/internalTools/voice/sendPlaceholderMessage.js +17 -7
- package/dist/internalTools/voice/sendPlaceholderMessage.js.map +1 -1
- package/dist/llm/createLlmInstance.d.ts.map +1 -1
- package/dist/nodes/addAppToolNode.d.ts.map +1 -1
- package/dist/nodes/addBrowserTaskNode.d.ts.map +1 -1
- package/dist/nodes/addBrowserTaskRunNode.d.ts.map +1 -1
- package/dist/nodes/addHumanInTheLoopNode.d.ts.map +1 -1
- package/dist/nodes/addHumanInTheLoopNode.js +1 -2
- package/dist/nodes/addHumanInTheLoopNode.js.map +1 -1
- package/dist/nodes/addJumpToNode.d.ts.map +1 -1
- package/dist/nodes/addJumpToNode.js +1 -1
- package/dist/nodes/addJumpToNode.js.map +1 -1
- package/dist/nodes/addJunctionNode.d.ts.map +1 -1
- package/dist/nodes/addPromptNode.d.ts.map +1 -1
- package/dist/nodes/addPromptNode.js +1 -43
- package/dist/nodes/addPromptNode.js.map +1 -1
- package/dist/nodes/addToolNode.d.ts.map +1 -1
- package/dist/nodes/addToolNode.js +0 -2
- package/dist/nodes/addToolNode.js.map +1 -1
- package/dist/nodes/addToolRunNode.d.ts.map +1 -1
- package/dist/nodes/addToolRunNode.js +0 -1
- package/dist/nodes/addToolRunNode.js.map +1 -1
- package/dist/nodes/addTriggerNode.d.ts.map +1 -1
- package/dist/nodes/compilePrompt.js +17 -7
- package/dist/nodes/compilePrompt.js.map +1 -1
- package/dist/nodes/nodeFactory.d.ts.map +1 -1
- package/dist/platform/mindedChatOpenAI.d.ts +5 -0
- package/dist/platform/mindedChatOpenAI.d.ts.map +1 -0
- package/dist/platform/mindedChatOpenAI.js +23 -0
- package/dist/platform/mindedChatOpenAI.js.map +1 -0
- package/dist/platform/mindedCheckpointSaver.js +17 -7
- package/dist/platform/mindedCheckpointSaver.js.map +1 -1
- package/dist/platform/mindedConnection.d.ts.map +1 -1
- package/dist/platform/mindedConnection.js +29 -19
- package/dist/platform/mindedConnection.js.map +1 -1
- package/dist/platform/mindedConnectionTypes.d.ts +1 -151
- package/dist/platform/mindedConnectionTypes.d.ts.map +1 -1
- package/dist/platform/mindedConnectionTypes.js +0 -9
- package/dist/platform/mindedConnectionTypes.js.map +1 -1
- package/dist/platform/piiGateway/gateway.js +17 -7
- package/dist/platform/piiGateway/gateway.js.map +1 -1
- package/dist/platform/utils/parseAttachments.d.ts.map +1 -1
- package/dist/playbooks/playbooks.js +23 -13
- package/dist/playbooks/playbooks.js.map +1 -1
- package/dist/toolsLibrary/classifier.d.ts.map +1 -1
- package/dist/toolsLibrary/index.js +17 -7
- package/dist/toolsLibrary/index.js.map +1 -1
- package/dist/toolsLibrary/parseDocument.d.ts +3 -3
- package/dist/types/Agent.types.d.ts +0 -2
- package/dist/types/Agent.types.d.ts.map +1 -1
- package/dist/types/Agent.types.js.map +1 -1
- package/dist/types/LangGraph.types.d.ts +2 -2
- package/dist/types/LangGraph.types.d.ts.map +1 -1
- package/dist/types/LangGraph.types.js +1 -3
- package/dist/types/LangGraph.types.js.map +1 -1
- package/dist/utils/extractStateMemoryResponse.d.ts.map +1 -1
- package/dist/utils/extractToolMemoryResponse.d.ts +4 -0
- package/dist/utils/extractToolMemoryResponse.d.ts.map +1 -0
- package/dist/utils/extractToolMemoryResponse.js +16 -0
- package/dist/utils/extractToolMemoryResponse.js.map +1 -0
- package/dist/utils/history.d.ts.map +1 -1
- package/dist/utils/wait.d.ts.map +1 -1
- package/dist/voice/voiceSession.d.ts.map +1 -1
- package/dist/voice/voiceSession.js +18 -16
- package/dist/voice/voiceSession.js.map +1 -1
- package/package.json +2 -2
- package/src/agent.ts +24 -94
- package/src/cli/index.ts +14 -14
- package/src/edges/edgeFactory.ts +2 -2
- package/src/nodes/addHumanInTheLoopNode.ts +1 -2
- package/src/nodes/addJumpToNode.ts +1 -1
- package/src/nodes/addPromptNode.ts +4 -48
- package/src/nodes/addToolNode.ts +0 -2
- package/src/nodes/addToolRunNode.ts +1 -1
- package/src/platform/mindedConnection.ts +12 -12
- package/src/platform/mindedConnectionTypes.ts +0 -187
- package/src/playbooks/playbooks.ts +7 -7
- package/src/types/Agent.types.ts +0 -2
- package/src/types/LangGraph.types.ts +1 -3
- package/src/voice/voiceSession.ts +1 -9
- package/dist/browserTask/README.md +0 -419
- package/dist/browserTask/browserAgent.py +0 -632
- package/dist/browserTask/captcha_isolated.png +0 -0
- package/dist/browserTask/executeBrowserTask.ts +0 -79
- package/dist/browserTask/requirements.txt +0 -8
- package/dist/browserTask/setup.sh +0 -144
- package/dist/interrupts/BaseInterruptSessionManager.d.ts +0 -52
- package/dist/interrupts/BaseInterruptSessionManager.d.ts.map +0 -1
- package/dist/interrupts/BaseInterruptSessionManager.js +0 -40
- package/dist/interrupts/BaseInterruptSessionManager.js.map +0 -1
- package/dist/interrupts/MemoryInterruptSessionManager.d.ts +0 -14
- package/dist/interrupts/MemoryInterruptSessionManager.d.ts.map +0 -1
- package/dist/interrupts/MemoryInterruptSessionManager.js +0 -60
- package/dist/interrupts/MemoryInterruptSessionManager.js.map +0 -1
- package/dist/interrupts/MindedInterruptSessionManager.d.ts +0 -13
- package/dist/interrupts/MindedInterruptSessionManager.d.ts.map +0 -1
- package/dist/interrupts/MindedInterruptSessionManager.js +0 -151
- package/dist/interrupts/MindedInterruptSessionManager.js.map +0 -1
- package/dist/interrupts/interruptSessionManagerFactory.d.ts +0 -3
- package/dist/interrupts/interruptSessionManagerFactory.d.ts.map +0 -1
- package/dist/interrupts/interruptSessionManagerFactory.js +0 -46
- package/dist/interrupts/interruptSessionManagerFactory.js.map +0 -1
- package/src/interrupts/BaseInterruptSessionManager.ts +0 -96
- package/src/interrupts/MemoryInterruptSessionManager.ts +0 -63
- package/src/interrupts/MindedInterruptSessionManager.ts +0 -162
- package/src/interrupts/interruptSessionManagerFactory.ts +0 -20
|
@@ -1,79 +0,0 @@
|
|
|
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
|
-
|
|
@@ -1,144 +0,0 @@
|
|
|
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!"
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { State } from '../types/LangGraph.types';
|
|
2
|
-
export declare enum InterruptType {
|
|
3
|
-
NEW_TRIGGERS = "NEW_TRIGGERS",
|
|
4
|
-
HUMAN_IN_THE_LOOP = "HUMAN_IN_THE_LOOP"
|
|
5
|
-
}
|
|
6
|
-
export declare const QUEUE_INTERRUPT_DETECTED_BEFORE_SPEECH = "QUEUE_INTERRUPT_DETECTED_BEFORE_SPEECH";
|
|
7
|
-
export interface QueuedMessage {
|
|
8
|
-
triggerBody: any;
|
|
9
|
-
triggerName: string;
|
|
10
|
-
appName?: string;
|
|
11
|
-
}
|
|
12
|
-
export interface InterruptPayload {
|
|
13
|
-
type: InterruptType.NEW_TRIGGERS;
|
|
14
|
-
updateStateObject?: Partial<State>;
|
|
15
|
-
id?: string;
|
|
16
|
-
}
|
|
17
|
-
export interface InterruptSessionManager {
|
|
18
|
-
isProcessed(sessionId: string): boolean | Promise<boolean>;
|
|
19
|
-
/**
|
|
20
|
-
* Atomically attempts to acquire a lock for the given session.
|
|
21
|
-
* This method should only succeed if the session is not already being processed.
|
|
22
|
-
*
|
|
23
|
-
* @param sessionId - The session ID to lock
|
|
24
|
-
* @returns true if the lock was successfully acquired, false if the session is already locked
|
|
25
|
-
*/
|
|
26
|
-
lock(sessionId: string): boolean | Promise<boolean>;
|
|
27
|
-
release(sessionId: string): void | Promise<void>;
|
|
28
|
-
enqueueMessage(sessionId: string, message: QueuedMessage): void | Promise<void>;
|
|
29
|
-
dequeueAll(sessionId: string): QueuedMessage[] | Promise<QueuedMessage[]>;
|
|
30
|
-
dequeue(sessionId: string): QueuedMessage | null | Promise<QueuedMessage | null>;
|
|
31
|
-
checkQueueAndInterrupt(sessionId: string, updateStateObject?: Partial<State>): Promise<boolean>;
|
|
32
|
-
}
|
|
33
|
-
export declare abstract class BaseInterruptSessionManager implements InterruptSessionManager {
|
|
34
|
-
abstract isProcessed(sessionId: string): boolean | Promise<boolean>;
|
|
35
|
-
/**
|
|
36
|
-
* Atomically attempts to acquire a lock for the given session.
|
|
37
|
-
* This method should only succeed if the session is not already being processed.
|
|
38
|
-
* Implementations must ensure this operation is atomic to prevent race conditions.
|
|
39
|
-
*
|
|
40
|
-
* @param sessionId - The session ID to lock
|
|
41
|
-
* @returns true if the lock was successfully acquired, false if the session is already locked
|
|
42
|
-
*/
|
|
43
|
-
abstract lock(sessionId: string): boolean | Promise<boolean>;
|
|
44
|
-
abstract release(sessionId: string): void | Promise<void>;
|
|
45
|
-
abstract enqueueMessage(sessionId: string, message: QueuedMessage): void | Promise<void>;
|
|
46
|
-
abstract dequeueAll(sessionId: string): QueuedMessage[] | Promise<QueuedMessage[]>;
|
|
47
|
-
abstract dequeue(sessionId: string): QueuedMessage | null | Promise<QueuedMessage | null>;
|
|
48
|
-
protected abstract hasQueuedMessages(sessionId: string): boolean | Promise<boolean>;
|
|
49
|
-
protected abstract getQueuedMessages(sessionId: string): QueuedMessage[] | Promise<QueuedMessage[]>;
|
|
50
|
-
checkQueueAndInterrupt(sessionId: string, updateStateObject?: Partial<State>): Promise<boolean>;
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=BaseInterruptSessionManager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BaseInterruptSessionManager.d.ts","sourceRoot":"","sources":["../../src/interrupts/BaseInterruptSessionManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAIjD,oBAAY,aAAa;IACvB,YAAY,iBAAiB;IAC7B,iBAAiB,sBAAsB;CACxC;AAED,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AC,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAC5D,QAAQ,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IACzD,QAAQ,CAAC,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IACxF,QAAQ,CAAC,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,aAAa,EAAE,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAClF,QAAQ,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAGzF,SAAS,CAAC,QAAQ,CAAC,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IACnF,SAAS,CAAC,QAAQ,CAAC,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,aAAa,EAAE,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAG7F,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;CA0BtG"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BaseInterruptSessionManager = exports.QUEUE_INTERRUPT_DETECTED_BEFORE_SPEECH = exports.InterruptType = void 0;
|
|
4
|
-
const langgraph_1 = require("@langchain/langgraph");
|
|
5
|
-
const logger_1 = require("../utils/logger");
|
|
6
|
-
var InterruptType;
|
|
7
|
-
(function (InterruptType) {
|
|
8
|
-
InterruptType["NEW_TRIGGERS"] = "NEW_TRIGGERS";
|
|
9
|
-
InterruptType["HUMAN_IN_THE_LOOP"] = "HUMAN_IN_THE_LOOP";
|
|
10
|
-
})(InterruptType || (exports.InterruptType = InterruptType = {}));
|
|
11
|
-
exports.QUEUE_INTERRUPT_DETECTED_BEFORE_SPEECH = 'QUEUE_INTERRUPT_DETECTED_BEFORE_SPEECH';
|
|
12
|
-
class BaseInterruptSessionManager {
|
|
13
|
-
// Common implementation of checkQueueAndInterrupt
|
|
14
|
-
async checkQueueAndInterrupt(sessionId, updateStateObject) {
|
|
15
|
-
if (await this.hasQueuedMessages(sessionId)) {
|
|
16
|
-
logger_1.logger.trace({ msg: 'graph has queued messagess, interrupting graph', sessionId });
|
|
17
|
-
// Interrupt the graph with NEW_TRIGGERS flag and optional updateStateObject
|
|
18
|
-
const interruptPayload = { type: InterruptType.NEW_TRIGGERS };
|
|
19
|
-
if (updateStateObject) {
|
|
20
|
-
interruptPayload.updateStateObject = {
|
|
21
|
-
messages: updateStateObject.messages,
|
|
22
|
-
memory: updateStateObject.memory,
|
|
23
|
-
history: updateStateObject.history,
|
|
24
|
-
sessionId: updateStateObject.sessionId,
|
|
25
|
-
sessionType: updateStateObject.sessionType,
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
throw new langgraph_1.GraphInterrupt([
|
|
29
|
-
{
|
|
30
|
-
value: interruptPayload,
|
|
31
|
-
when: 'during',
|
|
32
|
-
resumable: true,
|
|
33
|
-
},
|
|
34
|
-
]);
|
|
35
|
-
}
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
exports.BaseInterruptSessionManager = BaseInterruptSessionManager;
|
|
40
|
-
//# sourceMappingURL=BaseInterruptSessionManager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BaseInterruptSessionManager.js","sourceRoot":"","sources":["../../src/interrupts/BaseInterruptSessionManager.ts"],"names":[],"mappings":";;;AACA,oDAAsD;AACtD,4CAAyC;AAEzC,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,8CAA6B,CAAA;IAC7B,wDAAuC,CAAA;AACzC,CAAC,EAHW,aAAa,6BAAb,aAAa,QAGxB;AAEY,QAAA,sCAAsC,GAAG,wCAAwC,CAAC;AAsC/F,MAAsB,2BAA2B;IAqB/C,kDAAkD;IAClD,KAAK,CAAC,sBAAsB,CAAC,SAAiB,EAAE,iBAAkC;QAChF,IAAI,MAAM,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,EAAE,CAAC;YAC5C,eAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,gDAAgD,EAAE,SAAS,EAAE,CAAC,CAAC;YAEnF,4EAA4E;YAC5E,MAAM,gBAAgB,GAAqB,EAAE,IAAI,EAAE,aAAa,CAAC,YAAY,EAAE,CAAC;YAChF,IAAI,iBAAiB,EAAE,CAAC;gBACtB,gBAAgB,CAAC,iBAAiB,GAAG;oBACnC,QAAQ,EAAE,iBAAiB,CAAC,QAAQ;oBACpC,MAAM,EAAE,iBAAiB,CAAC,MAAM;oBAChC,OAAO,EAAE,iBAAiB,CAAC,OAAO;oBAClC,SAAS,EAAE,iBAAiB,CAAC,SAAS;oBACtC,WAAW,EAAE,iBAAiB,CAAC,WAAW;iBAC3C,CAAC;YACJ,CAAC;YAED,MAAM,IAAI,0BAAc,CAAC;gBACvB;oBACE,KAAK,EAAE,gBAAgB;oBACvB,IAAI,EAAE,QAAQ;oBACd,SAAS,EAAE,IAAI;iBAChB;aACF,CAAC,CAAC;QACL,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAhDD,kEAgDC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { BaseInterruptSessionManager, QueuedMessage } from './BaseInterruptSessionManager';
|
|
2
|
-
export declare class MemoryInterruptSessionManager extends BaseInterruptSessionManager {
|
|
3
|
-
private sessionProcessing;
|
|
4
|
-
private sessionMessageQueues;
|
|
5
|
-
isProcessed(sessionId: string): boolean;
|
|
6
|
-
lock(sessionId: string): boolean;
|
|
7
|
-
release(sessionId: string): void;
|
|
8
|
-
enqueueMessage(sessionId: string, message: QueuedMessage): void;
|
|
9
|
-
dequeueAll(sessionId: string): QueuedMessage[];
|
|
10
|
-
dequeue(sessionId: string): QueuedMessage | null;
|
|
11
|
-
protected hasQueuedMessages(sessionId: string): boolean;
|
|
12
|
-
protected getQueuedMessages(sessionId: string): QueuedMessage[];
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=MemoryInterruptSessionManager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MemoryInterruptSessionManager.d.ts","sourceRoot":"","sources":["../../src/interrupts/MemoryInterruptSessionManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,aAAa,EAA0C,MAAM,+BAA+B,CAAC;AAEnI,qBAAa,6BAA8B,SAAQ,2BAA2B;IAC5E,OAAO,CAAC,iBAAiB,CAAmC;IAC5D,OAAO,CAAC,oBAAoB,CAA2C;IAEvE,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAIvC,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAShC,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAIhC,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI;IAO/D,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,aAAa,EAAE;IAO9C,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI;IAiBhD,SAAS,CAAC,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAKvD,SAAS,CAAC,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,aAAa,EAAE;CAGhE"}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MemoryInterruptSessionManager = void 0;
|
|
4
|
-
const BaseInterruptSessionManager_1 = require("./BaseInterruptSessionManager");
|
|
5
|
-
class MemoryInterruptSessionManager extends BaseInterruptSessionManager_1.BaseInterruptSessionManager {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(...arguments);
|
|
8
|
-
this.sessionProcessing = new Map();
|
|
9
|
-
this.sessionMessageQueues = new Map();
|
|
10
|
-
}
|
|
11
|
-
isProcessed(sessionId) {
|
|
12
|
-
return this.sessionProcessing.get(sessionId) || false;
|
|
13
|
-
}
|
|
14
|
-
lock(sessionId) {
|
|
15
|
-
const isCurrentlyProcessed = this.sessionProcessing.get(sessionId) || false;
|
|
16
|
-
if (isCurrentlyProcessed) {
|
|
17
|
-
return false; // Could not acquire lock
|
|
18
|
-
}
|
|
19
|
-
this.sessionProcessing.set(sessionId, true);
|
|
20
|
-
return true; // Successfully acquired lock
|
|
21
|
-
}
|
|
22
|
-
release(sessionId) {
|
|
23
|
-
this.sessionProcessing.delete(sessionId);
|
|
24
|
-
}
|
|
25
|
-
enqueueMessage(sessionId, message) {
|
|
26
|
-
if (!this.sessionMessageQueues.has(sessionId)) {
|
|
27
|
-
this.sessionMessageQueues.set(sessionId, []);
|
|
28
|
-
}
|
|
29
|
-
this.sessionMessageQueues.get(sessionId).push(message);
|
|
30
|
-
}
|
|
31
|
-
dequeueAll(sessionId) {
|
|
32
|
-
const messages = this.sessionMessageQueues.get(sessionId) || [];
|
|
33
|
-
const result = [...messages];
|
|
34
|
-
this.sessionMessageQueues.set(sessionId, []);
|
|
35
|
-
return result;
|
|
36
|
-
}
|
|
37
|
-
dequeue(sessionId) {
|
|
38
|
-
const messages = this.sessionMessageQueues.get(sessionId) || [];
|
|
39
|
-
if (messages.length === 0) {
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
const firstMessage = messages.shift();
|
|
43
|
-
this.sessionMessageQueues.set(sessionId, messages);
|
|
44
|
-
// If the dequeued message has the special trigger name, recursively dequeue the next one
|
|
45
|
-
if (firstMessage.triggerName === BaseInterruptSessionManager_1.QUEUE_INTERRUPT_DETECTED_BEFORE_SPEECH) {
|
|
46
|
-
return this.dequeue(sessionId);
|
|
47
|
-
}
|
|
48
|
-
return firstMessage;
|
|
49
|
-
}
|
|
50
|
-
// Implementation of abstract methods from BaseInterruptSessionManager
|
|
51
|
-
hasQueuedMessages(sessionId) {
|
|
52
|
-
const queue = this.sessionMessageQueues.get(sessionId) || [];
|
|
53
|
-
return queue.length > 0;
|
|
54
|
-
}
|
|
55
|
-
getQueuedMessages(sessionId) {
|
|
56
|
-
return this.sessionMessageQueues.get(sessionId) || [];
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
exports.MemoryInterruptSessionManager = MemoryInterruptSessionManager;
|
|
60
|
-
//# sourceMappingURL=MemoryInterruptSessionManager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MemoryInterruptSessionManager.js","sourceRoot":"","sources":["../../src/interrupts/MemoryInterruptSessionManager.ts"],"names":[],"mappings":";;;AAAA,+EAAmI;AAEnI,MAAa,6BAA8B,SAAQ,yDAA2B;IAA9E;;QACU,sBAAiB,GAAyB,IAAI,GAAG,EAAE,CAAC;QACpD,yBAAoB,GAAiC,IAAI,GAAG,EAAE,CAAC;IA0DzE,CAAC;IAxDC,WAAW,CAAC,SAAiB;QAC3B,OAAO,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC;IACxD,CAAC;IAED,IAAI,CAAC,SAAiB;QACpB,MAAM,oBAAoB,GAAG,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC;QAC5E,IAAI,oBAAoB,EAAE,CAAC;YACzB,OAAO,KAAK,CAAC,CAAC,yBAAyB;QACzC,CAAC;QACD,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QAC5C,OAAO,IAAI,CAAC,CAAC,6BAA6B;IAC5C,CAAC;IAED,OAAO,CAAC,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AiB;QAC3C,MAAM,KAAK,GAAG,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;QAC7D,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;IAC1B,CAAC;IAES,iBAAiB,CAAC,SAAiB;QAC3C,OAAO,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;IACxD,CAAC;CACF;AA5DD,sEA4DC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { BaseInterruptSessionManager, QueuedMessage } from './BaseInterruptSessionManager';
|
|
2
|
-
export declare class MindedInterruptSessionManager extends BaseInterruptSessionManager {
|
|
3
|
-
constructor();
|
|
4
|
-
isProcessed(sessionId: string): Promise<boolean>;
|
|
5
|
-
lock(sessionId: string): Promise<boolean>;
|
|
6
|
-
release(sessionId: string): Promise<void>;
|
|
7
|
-
enqueueMessage(sessionId: string, message: QueuedMessage): Promise<void>;
|
|
8
|
-
dequeueAll(sessionId: string): Promise<QueuedMessage[]>;
|
|
9
|
-
dequeue(sessionId: string): Promise<QueuedMessage | null>;
|
|
10
|
-
protected hasQueuedMessages(sessionId: string): Promise<boolean>;
|
|
11
|
-
protected getQueuedMessages(sessionId: string): Promise<QueuedMessage[]>;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=MindedInterruptSessionManager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MindedInterruptSessionManager.d.ts","sourceRoot":"","sources":["../../src/interrupts/MindedInterruptSessionManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,aAAa,EAA0C,MAAM,+BAA+B,CAAC;AAsBnI,qBAAa,6BAA8B,SAAQ,2BAA2B;;IAKtE,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAgBhD,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAgBzC,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAezC,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBxE,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAgBvD,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;cAwB/C,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;cAgBtD,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;CAe/E"}
|
|
@@ -1,151 +0,0 @@
|
|
|
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 (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.MindedInterruptSessionManager = void 0;
|
|
27
|
-
const BaseInterruptSessionManager_1 = require("./BaseInterruptSessionManager");
|
|
28
|
-
const mindedConnection = __importStar(require("../platform/mindedConnection"));
|
|
29
|
-
const mindedConnectionTypes_1 = require("../platform/mindedConnectionTypes");
|
|
30
|
-
class MindedInterruptSessionManager extends BaseInterruptSessionManager_1.BaseInterruptSessionManager {
|
|
31
|
-
constructor() {
|
|
32
|
-
super();
|
|
33
|
-
}
|
|
34
|
-
async isProcessed(sessionId) {
|
|
35
|
-
var _a;
|
|
36
|
-
try {
|
|
37
|
-
const response = await mindedConnection.awaitEmit(mindedConnectionTypes_1.mindedConnectionSocketMessageType.INTERRUPT_SESSION_IS_PROCESSED, {
|
|
38
|
-
type: mindedConnectionTypes_1.mindedConnectionSocketMessageType.INTERRUPT_SESSION_IS_PROCESSED,
|
|
39
|
-
sessionId,
|
|
40
|
-
});
|
|
41
|
-
return (_a = response.isProcessed) !== null && _a !== void 0 ? _a : false;
|
|
42
|
-
}
|
|
43
|
-
catch (error) {
|
|
44
|
-
console.error('Error checking if session is processed:', error);
|
|
45
|
-
return false;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
async lock(sessionId) {
|
|
49
|
-
var _a;
|
|
50
|
-
try {
|
|
51
|
-
const response = await mindedConnection.awaitEmit(mindedConnectionTypes_1.mindedConnectionSocketMessageType.INTERRUPT_SESSION_LOCK, {
|
|
52
|
-
type: mindedConnectionTypes_1.mindedConnectionSocketMessageType.INTERRUPT_SESSION_LOCK,
|
|
53
|
-
sessionId,
|
|
54
|
-
});
|
|
55
|
-
return (_a = response.lockAcquired) !== null && _a !== void 0 ? _a : false;
|
|
56
|
-
}
|
|
57
|
-
catch (error) {
|
|
58
|
-
console.error('Error locking session:', error);
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
async release(sessionId) {
|
|
63
|
-
try {
|
|
64
|
-
await mindedConnection.awaitEmit(mindedConnectionTypes_1.mindedConnectionSocketMessageType.INTERRUPT_SESSION_RELEASE, {
|
|
65
|
-
type: mindedConnectionTypes_1.mindedConnectionSocketMessageType.INTERRUPT_SESSION_RELEASE,
|
|
66
|
-
sessionId,
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
catch (error) {
|
|
70
|
-
console.error('Error releasing session:', error);
|
|
71
|
-
throw error;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
async enqueueMessage(sessionId, message) {
|
|
75
|
-
try {
|
|
76
|
-
await mindedConnection.awaitEmit(mindedConnectionTypes_1.mindedConnectionSocketMessageType.INTERRUPT_SESSION_ENQUEUE, {
|
|
77
|
-
type: mindedConnectionTypes_1.mindedConnectionSocketMessageType.INTERRUPT_SESSION_ENQUEUE,
|
|
78
|
-
sessionId,
|
|
79
|
-
message,
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
catch (error) {
|
|
83
|
-
console.error('Error enqueuing message:', error);
|
|
84
|
-
throw error;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
async dequeueAll(sessionId) {
|
|
88
|
-
var _a;
|
|
89
|
-
try {
|
|
90
|
-
const response = await mindedConnection.awaitEmit(mindedConnectionTypes_1.mindedConnectionSocketMessageType.INTERRUPT_SESSION_DEQUEUE_ALL, {
|
|
91
|
-
type: mindedConnectionTypes_1.mindedConnectionSocketMessageType.INTERRUPT_SESSION_DEQUEUE_ALL,
|
|
92
|
-
sessionId,
|
|
93
|
-
});
|
|
94
|
-
return (_a = response.messages) !== null && _a !== void 0 ? _a : [];
|
|
95
|
-
}
|
|
96
|
-
catch (error) {
|
|
97
|
-
console.error('Error dequeuing all messages:', error);
|
|
98
|
-
return [];
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
async dequeue(sessionId) {
|
|
102
|
-
var _a;
|
|
103
|
-
try {
|
|
104
|
-
const response = await mindedConnection.awaitEmit(mindedConnectionTypes_1.mindedConnectionSocketMessageType.INTERRUPT_SESSION_DEQUEUE, {
|
|
105
|
-
type: mindedConnectionTypes_1.mindedConnectionSocketMessageType.INTERRUPT_SESSION_DEQUEUE,
|
|
106
|
-
sessionId,
|
|
107
|
-
});
|
|
108
|
-
const message = (_a = response.message) !== null && _a !== void 0 ? _a : null;
|
|
109
|
-
// If the dequeued message has the special trigger name, recursively dequeue the next one
|
|
110
|
-
if (message && message.triggerName === BaseInterruptSessionManager_1.QUEUE_INTERRUPT_DETECTED_BEFORE_SPEECH) {
|
|
111
|
-
return this.dequeue(sessionId);
|
|
112
|
-
}
|
|
113
|
-
return message;
|
|
114
|
-
}
|
|
115
|
-
catch (error) {
|
|
116
|
-
console.error('Error dequeuing message:', error);
|
|
117
|
-
return null;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
// Implementation of abstract methods from BaseInterruptSessionManager
|
|
121
|
-
async hasQueuedMessages(sessionId) {
|
|
122
|
-
var _a;
|
|
123
|
-
try {
|
|
124
|
-
const response = await mindedConnection.awaitEmit(mindedConnectionTypes_1.mindedConnectionSocketMessageType.INTERRUPT_SESSION_HAS_MESSAGES, {
|
|
125
|
-
type: mindedConnectionTypes_1.mindedConnectionSocketMessageType.INTERRUPT_SESSION_HAS_MESSAGES,
|
|
126
|
-
sessionId,
|
|
127
|
-
});
|
|
128
|
-
return (_a = response.hasMessages) !== null && _a !== void 0 ? _a : false;
|
|
129
|
-
}
|
|
130
|
-
catch (error) {
|
|
131
|
-
console.error('Error checking if session has messages:', error);
|
|
132
|
-
return false;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
async getQueuedMessages(sessionId) {
|
|
136
|
-
var _a;
|
|
137
|
-
try {
|
|
138
|
-
const response = await mindedConnection.awaitEmit(mindedConnectionTypes_1.mindedConnectionSocketMessageType.INTERRUPT_SESSION_GET_MESSAGES, {
|
|
139
|
-
type: mindedConnectionTypes_1.mindedConnectionSocketMessageType.INTERRUPT_SESSION_GET_MESSAGES,
|
|
140
|
-
sessionId,
|
|
141
|
-
});
|
|
142
|
-
return (_a = response.messages) !== null && _a !== void 0 ? _a : [];
|
|
143
|
-
}
|
|
144
|
-
catch (error) {
|
|
145
|
-
console.error('Error getting queued messages:', error);
|
|
146
|
-
return [];
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
exports.MindedInterruptSessionManager = MindedInterruptSessionManager;
|
|
151
|
-
//# sourceMappingURL=MindedInterruptSessionManager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MindedInterruptSessionManager.js","sourceRoot":"","sources":["../../src/interrupts/MindedInterruptSessionManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAAmI;AACnI,+EAAiE;AACjE,6EAkB2C;AAE3C,MAAa,6BAA8B,SAAQ,yDAA2B;IAC5E;QACE,KAAK,EAAE,CAAC;IACV,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,SAAiB;;QACjC,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,gBAAgB,CAAC,SAAS,CAC/C,yDAAiC,CAAC,8BAA8B,EAChE;gBACE,IAAI,EAAE,yDAAiC,CAAC,8BAA8B;gBACtE,SAAS;aACV,CACF,CAAC;YACF,OAAO,MAAA,QAAQ,CAAC,WAAW,mCAAI,KAAK,CAAC;QACvC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,yCAAyC,EAAE,KAAK,CAAC,CAAC;YAChE,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,SAAiB;;QAC1B,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,gBAAgB,CAAC,SAAS,CAC/C,yDAAi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,CAAC;IAES,KAAK,CAAC,iBAAiB,CAAC,SAAiB;;QACjD,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,gBAAgB,CAAC,SAAS,CAC/C,yDAAiC,CAAC,8BAA8B,EAChE;gBACE,IAAI,EAAE,yDAAiC,CAAC,8BAA8B;gBACtE,SAAS;aACV,CACF,CAAC;YACF,OAAO,MAAA,QAAQ,CAAC,QAAQ,mCAAI,EAAE,CAAC;QACjC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,gCAAgC,EAAE,KAAK,CAAC,CAAC;YACvD,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;CACF;AA3ID,sEA2IC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interruptSessionManagerFactory.d.ts","sourceRoot":"","sources":["../../src/interrupts/interruptSessionManagerFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAOxE,wBAAgB,6BAA6B,IAAI,uBAAuB,CAYvE"}
|
|
@@ -1,46 +0,0 @@
|
|
|
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 (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.createInterruptSessionManager = createInterruptSessionManager;
|
|
27
|
-
const MemoryInterruptSessionManager_1 = require("./MemoryInterruptSessionManager");
|
|
28
|
-
const MindedInterruptSessionManager_1 = require("./MindedInterruptSessionManager");
|
|
29
|
-
const mindedConnection = __importStar(require("../platform/mindedConnection"));
|
|
30
|
-
const config_1 = require("../platform/config");
|
|
31
|
-
const logger_1 = require("../utils/logger");
|
|
32
|
-
function createInterruptSessionManager() {
|
|
33
|
-
const { runLocally } = (0, config_1.getConfig)();
|
|
34
|
-
if (runLocally) {
|
|
35
|
-
logger_1.logger.info({ msg: 'Using memory interrupt session manager' });
|
|
36
|
-
return new MemoryInterruptSessionManager_1.MemoryInterruptSessionManager();
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
if (!mindedConnection.isConnected()) {
|
|
40
|
-
throw new Error('MindedConnection is required for platform interrupt session manager');
|
|
41
|
-
}
|
|
42
|
-
logger_1.logger.info({ msg: 'Using Minded interrupt session manager' });
|
|
43
|
-
return new MindedInterruptSessionManager_1.MindedInterruptSessionManager();
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=interruptSessionManagerFactory.js.map
|