diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1332136fa17..f32605870b8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -17,6 +17,9 @@ importers: '@coinbase/coinbase-sdk': specifier: 0.10.0 version: 0.10.0(bufferutil@4.0.8)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.23.8) + '@deepgram/sdk': + specifier: ^3.9.0 + version: 3.9.0(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) '@vitest/eslint-plugin': specifier: 1.0.1 version: 1.0.1(@typescript-eslint/utils@8.16.0(eslint@9.16.0(jiti@2.4.0))(typescript@5.6.3))(eslint@9.16.0(jiti@2.4.0))(typescript@5.6.3)(vitest@2.1.5(@types/node@22.8.4)(jsdom@25.0.1(bufferutil@4.0.8)(canvas@2.11.2(encoding@0.1.13))(utf-8-validate@5.0.10))(terser@5.37.0)) @@ -3026,6 +3029,14 @@ packages: peerDependencies: postcss: ^8.4 + '@deepgram/captions@1.2.0': + resolution: {integrity: sha512-8B1C/oTxTxyHlSFubAhNRgCbQ2SQ5wwvtlByn8sDYZvdDtdn/VE2yEPZ4BvUnrKWmsbTQY6/ooLV+9Ka2qmDSQ==} + engines: {node: '>=18.0.0'} + + '@deepgram/sdk@3.9.0': + resolution: {integrity: sha512-X/7JzoYjCObyEaPb2Dgnkwk2LwRe4bw0FJJCLdkjpnFfJCFgA9IWgRD8FEUI6/hp8dW/CqqXkGPA2Q3DIsVG8A==} + engines: {node: '>=18.0.0'} + '@derhuerst/http-basic@8.2.4': resolution: {integrity: sha512-F9rL9k9Xjf5blCz8HsJRO4diy111cayL2vkY2XE4r4t3n0yPXVYy3KD3nJ1qbrSn9743UWSXH4IwuCa/HWlGFw==} engines: {node: '>=6.0.0'} @@ -3088,6 +3099,7 @@ packages: resolution: {integrity: sha512-hArn9FF5ZYi1IkxdJEVnJi+OxlwLV0NJYWpKXsmNOojtGtAZHxmsELA+MZlu2KW1F/K1/nt7lFOfcMXNYweq9w==} version: 0.17.0 engines: {node: '>=16.11.0'} + deprecated: This version uses deprecated encryption modes. Please use a newer version. '@discordjs/ws@1.1.1': resolution: {integrity: sha512-PZ+vLpxGCRtmr2RMkqh8Zp+BenUaJqlS6xhgWKEZcgC/vfHLEzpHtKkB0sl3nZWpwtcKk6YWy+pU3okL2I97FA==} @@ -19268,6 +19280,23 @@ snapshots: dependencies: postcss: 8.4.49 + '@deepgram/captions@1.2.0': + dependencies: + dayjs: 1.11.13 + + '@deepgram/sdk@3.9.0(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10)': + dependencies: + '@deepgram/captions': 1.2.0 + '@types/node': 18.19.68 + cross-fetch: 3.1.8(encoding@0.1.13) + deepmerge: 4.3.1 + events: 3.3.0 + ws: 8.18.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) + transitivePeerDependencies: + - bufferutil + - encoding + - utf-8-validate + '@derhuerst/http-basic@8.2.4': dependencies: caseless: 0.12.0 @@ -37044,4 +37073,4 @@ snapshots: zx@8.2.4: optionalDependencies: '@types/fs-extra': 11.0.4 - '@types/node': 20.17.9 \ No newline at end of file + '@types/node': 20.17.9 diff --git a/scripts/smokeTests.sh b/scripts/smokeTests.sh index fcce311fe1d..fb05946897f 100755 --- a/scripts/smokeTests.sh +++ b/scripts/smokeTests.sh @@ -1,5 +1,8 @@ #!/bin/bash +# Strict mode, exit on error, undefined variables, and pipe failures +set -euo pipefail + # Print some information about the environment to aid in case of troubleshooting echo "node version:" @@ -27,20 +30,9 @@ if (( CURRENT_NODE_VERSION < REQUIRED_NODE_VERSION )); then fi # Autodetect project directory relative to this script's path -PROJECT_DIR="$0" -while [ -h "$PROJECT_DIR" ]; do - ls=$(ls -ld "$PROJECT_DIR") - link=$(expr "$ls" : '.*-> \(.*\)$') - if expr "$link" : '/.*' > /dev/null; then - PROJECT_DIR="$link" - else - PROJECT_DIR="$(dirname "$PROJECT_DIR")/$link" - fi -done -PROJECT_DIR="$(dirname "$PROJECT_DIR")/.." -PROJECT_DIR="$(cd "$PROJECT_DIR"; pwd)" +PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" -cd $PROJECT_DIR +cd "$PROJECT_DIR" cp .env.example .env @@ -48,39 +40,53 @@ pnpm install -r pnpm build +# Create temp file and ensure cleanup OUTFILE="$(mktemp)" -echo $OUTFILE +trap 'rm -f "$OUTFILE"' EXIT +echo "Using temporary output file: $OUTFILE" + +# Add timeout configuration +TIMEOUT=30 +INTERVAL=0.5 +TIMER=0 + ( - # Wait for the ready message + # Wait for the ready message with timeout while true; do + if [[ $TIMER -ge $TIMEOUT ]]; then + echo "Error: Timeout waiting for application to start after $TIMEOUT seconds" + kill $$ + exit 1 + fi + if grep -q "Chat started" "$OUTFILE"; then echo "exit"; sleep 2 break fi - sleep 0.5 + + sleep $INTERVAL + TIMER=$(echo "$TIMER + $INTERVAL" | bc) done ) | pnpm start --character=characters/trump.character.json > "$OUTFILE" & # Wait for process to finish wait $! RESULT=$? + echo "----- OUTPUT START -----" cat "$OUTFILE" echo "----- OUTPUT END -----" # Check the exit code of the last command if [[ $RESULT -ne 0 ]]; then - echo "Error: 'start' command exited with an error." + echo "Error: 'start' command exited with an error (code: $RESULT)" exit 1 fi -# Check if output.txt contains "Terminating and cleaning up resources..." +# Check if output contains expected termination message if grep -q "Terminating and cleaning up resources..." "$OUTFILE"; then echo "Script completed successfully." else - echo "Error: The output does not contain the expected string." + echo "Error: The output does not contain the expected termination message." exit 1 -fi - -# Clean up -rm "$OUTFILE" +fi \ No newline at end of file