@nicfox77/parakeet-stt 0.2.3 → 0.2.4

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/scripts/install.sh +43 -32
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nicfox77/parakeet-stt",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "Parakeet TDT INT8 speech-to-text plugin for OpenClaw. Supports V2 (English) and V3 (Multilingual) models.",
5
5
  "type": "module",
6
6
  "repository": {
@@ -151,14 +151,6 @@ configure_openclaw() {
151
151
  return 1
152
152
  fi
153
153
 
154
- # Check if jq is available
155
- if ! command -v jq &> /dev/null; then
156
- echo "Warning: jq not found, skipping automatic config"
157
- echo "Please manually add to openclaw.json:"
158
- echo ' tools.media.audio.models: [{"type": "cli", "command": "'$PARAKEET_DIR'/parakeet-audio-client.py", "args": ["{{MediaPath}}", "{{OutputDir}}"]}]'
159
- return 1
160
- fi
161
-
162
154
  # Check if parakeet is already configured
163
155
  if jq -e '.tools.media.audio.models[]? | select(.command | contains("parakeet"))' "$OPENCLAW_CONFIG" > /dev/null 2>&1; then
164
156
  echo "Parakeet already configured in OpenClaw"
@@ -167,35 +159,54 @@ configure_openclaw() {
167
159
 
168
160
  echo "Configuring OpenClaw to use Parakeet for audio transcription..."
169
161
 
170
- # Add parakeet to audio models
171
- local tmp_config=$(mktemp)
172
- jq '.tools.media.audio.models += [{
173
- "type": "cli",
174
- "command": "'$PARAKEET_DIR'/parakeet-audio-client.py",
175
- "args": ["{{MediaPath}}", "{{OutputDir}}"]
176
- }]' "$OPENCLAW_CONFIG" > "$tmp_config" && mv "$tmp_config" "$OPENCLAW_CONFIG"
177
-
178
- echo "Added Parakeet to tools.media.audio.models"
179
- }
180
-
181
- configure_openclaw || true
182
-
183
- # Apply config changes properly (requires config.apply, not just restart)
184
- apply_config() {
162
+ # Use config.patch RPC for partial update (cleaner than modifying file directly)
185
163
  if command -v openclaw &> /dev/null; then
186
- echo ""
187
- echo "Applying configuration to OpenClaw gateway..."
188
- openclaw gateway call config.apply --params '{"raw": "'$(cat "$OPENCLAW_CONFIG" | jq -c '.')'", "note": "Parakeet STT installation"}' 2>/dev/null || {
189
- echo "Note: Could not apply config automatically. Please run:"
190
- echo " openclaw gateway restart"
164
+ local patch_json=$(cat <<EOF
165
+ {
166
+ "patch": {
167
+ "tools": {
168
+ "media": {
169
+ "audio": {
170
+ "models": [
171
+ {
172
+ "type": "cli",
173
+ "command": "$PARAKEET_DIR/parakeet-audio-client.py",
174
+ "args": ["{{MediaPath}}", "{{OutputDir}}"]
175
+ }
176
+ ]
191
177
  }
178
+ }
179
+ }
180
+ }
181
+ }
182
+ EOF
183
+ )
184
+ openclaw gateway call config.patch --params "$patch_json" 2>/dev/null && {
185
+ echo "Applied config.patch - Parakeet configured and gateway reloaded"
186
+ return 0
187
+ } || {
188
+ echo "config.patch failed, falling back to file modification..."
189
+ }
190
+ fi
191
+
192
+ # Fallback: modify config file directly if jq available
193
+ if command -v jq &> /dev/null; then
194
+ local tmp_config=$(mktemp)
195
+ jq '.tools.media.audio.models += [{
196
+ "type": "cli",
197
+ "command": "'$PARAKEET_DIR'/parakeet-audio-client.py",
198
+ "args": ["{{MediaPath}}", "{{OutputDir}}"]
199
+ }]' "$OPENCLAW_CONFIG" > "$tmp_config" && mv "$tmp_config" "$OPENCLAW_CONFIG"
200
+ echo "Added Parakeet to tools.media.audio.models (file modified directly)"
201
+ echo "Note: Gateway will auto-reload, or run: openclaw gateway restart"
202
+ else
203
+ echo "Warning: jq not found, skipping automatic config"
204
+ echo "Please manually add to openclaw.json:"
205
+ echo ' tools.media.audio.models: [{"type": "cli", "command": "'$PARAKEET_DIR'/parakeet-audio-client.py", "args": ["{{MediaPath}}", "{{OutputDir}}"]}]'
192
206
  fi
193
207
  }
194
208
 
195
- # Only apply if we added new config
196
- if jq -e '.tools.media.audio.models[]? | select(.command | contains("parakeet"))' "$OPENCLAW_CONFIG" > /dev/null 2>&1; then
197
- apply_config
198
- fi
209
+ configure_openclaw || true
199
210
 
200
211
  echo ""
201
212
  echo "=== Installation Complete ==="