diff --git a/Launch Semantic Server.command b/Launch Semantic Server.command index 4d33b76..599d2da 100755 --- a/Launch Semantic Server.command +++ b/Launch Semantic Server.command @@ -28,6 +28,53 @@ echo "๐Ÿงน Cleaning up..." lsof -ti:8765 | xargs kill -9 2>/dev/null sleep 1 +# --- PYTHON VERSION ENFORCEMENT --- +# The following block strictly enforces the use of Python 3.13.11. +# This is a critical system requirement. No other version is permitted. +# Any deviation will cause an immediate and fatal system exit. + +# Capture the exact version string of the 'python3' command. +# This executes 'python3 --version' and stores the output (e.g., "Python 3.13.11"). +# We use the system python first to check, or assume venv usage. +# Since this script activates venv later, we should check the python that WILL be used. +# But 'source venv/bin/activate' changes the python context. + +echo "๐Ÿ Verifying Python Version..." + +# We need to check the python version inside the venv if it exists, or the system python. +# If venv exists, we use it. +if [ -d "venv" ]; then + PYTHON_CMD="venv/bin/python3" +else + PYTHON_CMD="python3" +fi + +CURRENT_PYTHON_VERSION=$($PYTHON_CMD --version 2>&1) +REQUIRED_PYTHON_VERSION="Python 3.13.11" + +# Compare the current version with the required version. +if [ "$CURRENT_PYTHON_VERSION" != "$REQUIRED_PYTHON_VERSION" ]; then + echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + echo "CRITICAL ERROR: INCORRECT PYTHON VERSION DETECTED" + echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + echo "" + echo "The system requires exactly: $REQUIRED_PYTHON_VERSION" + echo "You are currently running: $CURRENT_PYTHON_VERSION" + echo "Command used: $PYTHON_CMD" + echo "" + echo "This enforcement is hard-coded to prevent compatibility issues." + echo "Please install Python 3.13.11 and ensure it is available." + echo "" + echo "Process aborted." + echo "" + echo "Press any key to close..." + read -n 1 + exit 1 +fi + +echo "โœ… Python Version Verified: $CURRENT_PYTHON_VERSION" + + # Start Python backend echo "๐Ÿ Starting backend..." source venv/bin/activate && python3 main.py & diff --git a/launch.sh b/launch.sh index ef0de28..e41f594 100755 --- a/launch.sh +++ b/launch.sh @@ -25,6 +25,43 @@ fi # Check which python we are using which python3 +# --- 2.1 PYTHON VERSION ENFORCEMENT --- +# The following block strictly enforces the use of Python 3.13.11. +# This is a critical system requirement. No other version is permitted. +# Any deviation will cause an immediate and fatal system exit. + +# Capture the exact version string of the 'python3' command. +# This executes 'python3 --version' and stores the output (e.g., "Python 3.13.11"). +CURRENT_PYTHON_VERSION=$(python3 --version 2>&1) + +# Define the strictly required version string. +# This MUST be exactly "Python 3.13.11". +REQUIRED_PYTHON_VERSION="Python 3.13.11" + +# Compare the current version with the required version. +# If the strings are not identical, the system is in an invalid state. +if [ "$CURRENT_PYTHON_VERSION" != "$REQUIRED_PYTHON_VERSION" ]; then + # Print a loud, clear error message to the console. + echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + echo "CRITICAL ERROR: INCORRECT PYTHON VERSION DETECTED" + echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + echo "" + echo "The system requires exactly: $REQUIRED_PYTHON_VERSION" + echo "You are currently running: $CURRENT_PYTHON_VERSION" + echo "" + echo "This enforcement is hard-coded to prevent compatibility issues." + echo "Please install Python 3.13.11 and ensure it is the default 'python3'." + echo "" + echo "Process aborted." + + # Exit with a non-zero status code (1) to indicate failure. + # This stops the script immediately. + exit 1 +fi + +# If we passed the check, log success. +echo "โœ… Python Version Verified: $CURRENT_PYTHON_VERSION" + # Check for .env file if [ ! -f ".env" ]; then echo "Error: .env file not found. Please create one with ASSEMBLYAI_API_KEY." diff --git a/main.py b/main.py index 1f000de..88def40 100644 --- a/main.py +++ b/main.py @@ -12,6 +12,46 @@ from pathlib import Path from typing import Any, cast, List, Optional, TypedDict, Dict +# --- 0. CRITICAL SYSTEM ENFORCEMENT --- +# The following block strictly enforces the use of Python 3.13.11. +# This check is performed immediately upon module load to prevent +# any execution in an unsupported environment. + +# Define the required version tuple (Major, Minor, Micro) +# STRICT REQUIREMENT: Python 3.13.11 +REQUIRED_VERSION_INFO = (3, 13, 11) + +# Check the current system version against the requirement. +# sys.version_info returns a named tuple (major, minor, micro, releaselevel, serial). +# We only care about major, minor, and micro for this enforcement. +if sys.version_info[:3] != REQUIRED_VERSION_INFO: + # Construct a clear error message with current and required versions. + current_ver = f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}" + required_ver = f"{REQUIRED_VERSION_INFO[0]}.{REQUIRED_VERSION_INFO[1]}.{REQUIRED_VERSION_INFO[2]}" + + error_msg = ( + "\n" + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n" + "CRITICAL RUNTIME ERROR: INCORRECT PYTHON VERSION DETECTED\n" + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n" + f"The system requires exactly: Python {required_ver}\n" + f"You are currently running: Python {current_ver}\n\n" + "This enforcement is hard-coded to prevent compatibility issues.\n" + f"Please install Python {required_ver} and ensure it is the default interpreter.\n\n" + "Process aborted immediately.\n" + ) + + # Print to stderr to ensure visibility even if stdout is buffered or redirected. + sys.stderr.write(error_msg) + + # Force an immediate exit with status code 1. + sys.exit(1) + +# Log success if verify passes (will only run if sys.exit didn't happen) +# We can't use logger yet as it's not configured, so we use print/stderr. +# sys.stderr.write(f"โœ… Python Runtime Verified: {sys.version.split()[0]}\n") + + from dotenv import load_dotenv load_dotenv() diff --git a/package-lock.json b/package-lock.json index 9ecbf02..c75064d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -431,20 +431,20 @@ } }, "node_modules/@langchain/core": { - "version": "1.0.0-alpha.7", - "resolved": "https://registry.npmjs.org/@langchain/core/-/core-1.0.0-alpha.7.tgz", - "integrity": "sha512-29bS3mbDsHdjzcalReO9pKZ1qFf/R6fjwdiXuvVfp5HPd/RdbZAwitcGr4zPSX2z1xreyxpbcJBLkcIBb5L20w==", + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/@langchain/core/-/core-1.1.8.tgz", + "integrity": "sha512-kIUidOgc0ZdyXo4Ahn9Zas+OayqOfk4ZoKPi7XaDipNSWSApc2+QK5BVcjvwtzxstsNOrmXJiJWEN6WPF/MvAw==", "license": "MIT", + "peer": true, "dependencies": { "@cfworker/json-schema": "^4.0.2", "ansi-styles": "^5.0.0", "camelcase": "6", "decamelize": "1.2.0", "js-tiktoken": "^1.0.12", - "langsmith": "^0.3.64", + "langsmith": ">=0.4.0 <1.0.0", "mustache": "^4.2.0", "p-queue": "^6.6.2", - "p-retry": "4", "uuid": "^10.0.0", "zod": "^3.25.76 || ^4" }, @@ -465,9 +465,9 @@ } }, "node_modules/@langchain/core/node_modules/langsmith": { - "version": "0.3.84", - "resolved": "https://registry.npmjs.org/langsmith/-/langsmith-0.3.84.tgz", - "integrity": "sha512-6mXv89zTJ77ph/aroFVhI55YFNxsParGWNhPh1vLpma5GjnaWwkQXz3H9UBezaNEzVQOYK4mCOnIFANyccBG2A==", + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/langsmith/-/langsmith-0.4.2.tgz", + "integrity": "sha512-BvBeFgSmR9esl8x5wsiDlALiHKKPybw2wE2Hh6x1tgSZki46H9c9KI9/06LARbPhyyDu/TZU7exfg6fnhdj1Qg==", "license": "MIT", "dependencies": { "@types/uuid": "^10.0.0", @@ -589,29 +589,6 @@ } } }, - "node_modules/@langchain/openai/node_modules/ws": { - "version": "8.18.3", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.3.tgz", - "integrity": "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==", - "license": "MIT", - "optional": true, - "peer": true, - "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": ">=5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, "node_modules/@malept/cross-spawn-promise": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@malept/cross-spawn-promise/-/cross-spawn-promise-1.1.1.tgz", @@ -953,6 +930,7 @@ "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -1155,7 +1133,6 @@ "integrity": "sha512-+25nxyyznAXF7Nef3y0EbBeqmGZgeN/BxHX29Rs39djAfaFalmQ89SE6CWyDCHzGL0yt/ycBtNOmGTW0FyGWNw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "archiver-utils": "^2.1.0", "async": "^3.2.4", @@ -1175,7 +1152,6 @@ "integrity": "sha512-bEL/yUb/fNNiNTuUz979Z0Yg5L+LzLxGJz8x79lYmR54fmTIb6ob/hNQgkQnIUDWIFjZVQwl9Xs356I6BAMHfw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "glob": "^7.1.4", "graceful-fs": "^4.2.0", @@ -1198,7 +1174,6 @@ "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -1214,8 +1189,7 @@ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/archiver-utils/node_modules/string_decoder": { "version": "1.1.1", @@ -1223,7 +1197,6 @@ "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "safe-buffer": "~5.1.0" } @@ -1479,7 +1452,6 @@ "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "buffer": "^5.5.0", "inherits": "^2.0.4", @@ -2000,7 +1972,6 @@ "integrity": "sha512-D3uMHtGc/fcO1Gt1/L7i1e33VOvD4A9hfQLP+6ewd+BvG/gQ84Yh4oftEhAdjSMgBgwGL+jsppT7JYNpo6MHHg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "buffer-crc32": "^0.2.13", "crc32-stream": "^4.0.2", @@ -2213,7 +2184,6 @@ "integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==", "dev": true, "license": "Apache-2.0", - "peer": true, "bin": { "crc32": "bin/crc32.njs" }, @@ -2227,7 +2197,6 @@ "integrity": "sha512-NT7w2JVU7DFroFdYkeq8cywxrgjPHWkdX1wjpRQXPX5Asews3tA+Ght6lddQO5Mkumffp3X7GEqku3epj2toIw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "crc-32": "^1.2.0", "readable-stream": "^3.4.0" @@ -2506,6 +2475,7 @@ "integrity": "sha512-rcJUkMfnJpfCboZoOOPf4L29TRtEieHNOeAbYPWPxlaBw/Z1RKrRA86dOI9rwaI4tQSc/RD82zTNHprfUHXsoQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "app-builder-lib": "24.13.3", "builder-util": "24.13.1", @@ -2716,7 +2686,6 @@ "integrity": "sha512-oHkV0iogWfyK+ah9ZIvMDpei1m9ZRpdXcvde1wTpra2U8AFDNNpqJdnin5z+PM1GbQ5BoaKCWas2HSjtR0HwMg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "app-builder-lib": "24.13.3", "archiver": "^5.3.1", @@ -2730,7 +2699,6 @@ "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", @@ -2746,7 +2714,6 @@ "integrity": "sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "universalify": "^2.0.0" }, @@ -2760,7 +2727,6 @@ "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">= 10.0.0" } @@ -3488,8 +3454,7 @@ "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/fs-extra": { "version": "8.1.0", @@ -4520,8 +4485,7 @@ "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/isbinaryfile": { "version": "5.0.6", @@ -4889,7 +4853,6 @@ "integrity": "sha512-b94GiNHQNy6JNTrt5w6zNyffMrNkXZb3KTkCZJb2V1xaEGCk093vkZ2jk3tpaeP33/OiXC+WvK9AxUebnf5nbw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "readable-stream": "^2.0.5" }, @@ -4903,7 +4866,6 @@ "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -4919,8 +4881,7 @@ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/lazystream/node_modules/string_decoder": { "version": "1.1.1", @@ -4928,7 +4889,6 @@ "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "safe-buffer": "~5.1.0" } @@ -4956,24 +4916,21 @@ "resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-4.2.0.tgz", "integrity": "sha512-qjxPLHd3r5DnsdGacqOMU6pb/avJzdh9tFX2ymgoZE27BmjXrNy/y4LoaiTeAb+O3gL8AfpJGtqfX/ae2leYYQ==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/lodash.difference": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.difference/-/lodash.difference-4.5.0.tgz", "integrity": "sha512-dS2j+W26TQ7taQBGN8Lbbq04ssV3emRw4NY58WErlTO29pIqS0HmoT5aJ9+TUQ1N3G+JOZSji4eugsWwGp9yPA==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/lodash.flatten": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz", "integrity": "sha512-C5N2Z3DgnnKr0LOpv/hKCgKdb7ZZwafIrsesve6lmzvZIRZRGaZ/l6Q8+2W7NaT+ZwO3fFlSCzCzrDCFdJfZ4g==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/lodash.includes": { "version": "4.3.0", @@ -5022,8 +4979,7 @@ "resolved": "https://registry.npmjs.org/lodash.union/-/lodash.union-4.6.0.tgz", "integrity": "sha512-c4pB2CdGrGdjMKYLA+XiRDO7Y0PRQbm/Gzg8qMj+QH+pFVAoTp5sBpO0odL3FjoPCGjK96p6qsP+yQoiLoOBcw==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/lowercase-keys": { "version": "2.0.0", @@ -5342,7 +5298,6 @@ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=0.10.0" } @@ -5664,8 +5619,7 @@ "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/processenv": { "version": "1.1.0", @@ -5840,7 +5794,6 @@ "integrity": "sha512-v05I2k7xN8zXvPD9N+z/uhXPaj0sUFCe2rcWZIpBsqxfP7xXFQ0tipAd/wjj1YxWyWtUS5IDJpOG82JKt2EAVA==", "dev": true, "license": "Apache-2.0", - "peer": true, "dependencies": { "minimatch": "^5.1.0" } @@ -6726,7 +6679,6 @@ "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "bl": "^4.0.3", "end-of-stream": "^1.4.1", @@ -7355,7 +7307,6 @@ "integrity": "sha512-9qv4rlDiopXg4E69k+vMHjNN63YFMe9sZMrdlvKnCjlCRWeCBswPPMPUfx+ipsAWq1LXHe70RcbaHdJJpS6hyQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "archiver-utils": "^3.0.4", "compress-commons": "^4.1.2", @@ -7371,7 +7322,6 @@ "integrity": "sha512-KVgf4XQVrTjhyWmx6cte4RxonPLR9onExufI1jhvw/MQ4BB6IsZD5gT8Lq+u/+pRkWna/6JoHpiQioaqFP5Rzw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "glob": "^7.2.3", "graceful-fs": "^4.2.0", @@ -7393,6 +7343,7 @@ "resolved": "https://registry.npmjs.org/zod/-/zod-4.1.13.tgz", "integrity": "sha512-AvvthqfqrAhNH9dnfmrfKzX5upOdjUVJYFqNSlkmGf64gRaTzlPwz99IHYnVs28qYAybvAlBV+H7pn0saFY4Ig==", "license": "MIT", + "peer": true, "funding": { "url": "https://github.com/sponsors/colinhacks" }