pai-zero 0.9.1 → 0.9.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/bin/pai.js CHANGED
@@ -5328,19 +5328,44 @@ try {
5328
5328
 
5329
5329
  echo "$MSG" > "$TODAY_FILE"
5330
5330
 
5331
- # macOS: Open Terminal + Claude Code
5331
+ # macOS: GUI \uC138\uC158 \uB300\uAE30 \uD6C4 Terminal \uC2E4\uD589
5332
5332
  if [[ "$(uname)" == "Darwin" ]]; then
5333
+ # Sleep\uC5D0\uC11C \uAE68\uC5B4\uB09C \uC9C1\uD6C4 GUI\uAC00 \uC544\uC9C1 \uC900\uBE44 \uC548 \uB428 \u2014 \uB85C\uADF8\uC778 \uD654\uBA74 \uC7A0\uAE08 \uD574\uC81C \uB300\uAE30
5334
+ MAX_WAIT=300 # \uCD5C\uB300 5\uBD84 \uB300\uAE30
5335
+ WAITED=0
5336
+ while [ $WAITED -lt $MAX_WAIT ]; do
5337
+ # WindowServer \uD504\uB85C\uC138\uC2A4\uAC00 \uC788\uACE0 \uCF58\uC194 \uC0AC\uC6A9\uC790\uAC00 \uC788\uC73C\uBA74 GUI \uC900\uBE44 \uC644\uB8CC
5338
+ if pgrep -q "WindowServer" && [ "$(stat -f%Su /dev/console 2>/dev/null)" = "$(whoami)" ]; then
5339
+ echo "[$(date)] GUI session ready (waited \${WAITED}s)" >> "$LOG_FILE"
5340
+ break
5341
+ fi
5342
+ sleep 5
5343
+ WAITED=$((WAITED + 5))
5344
+ done
5345
+
5346
+ if [ $WAITED -ge $MAX_WAIT ]; then
5347
+ echo "[$(date)] GUI session timeout \u2014 skipping Terminal launch" >> "$LOG_FILE"
5348
+ exit 0
5349
+ fi
5350
+
5351
+ # \uCD94\uAC00 \uC548\uC815\uD654 \uB300\uAE30
5352
+ sleep 10
5353
+
5333
5354
  # Notification
5334
5355
  FIRST_LINE=$(echo "$MSG" | head -1 | cut -c1-80)
5335
5356
  osascript -e "display notification \\"$FIRST_LINE\\" with title \\"\u2600\uFE0F PAI Wakeup\\" subtitle \\"Claude Code \uC138\uC158\uC744 \uC2DC\uC791\uD569\uB2C8\uB2E4\\"" 2>/dev/null
5336
5357
 
5337
- # Open Terminal.app with Claude Code
5338
- osascript <<'APPLESCRIPT'
5358
+ # Open Terminal.app with Claude Code (\uC7AC\uC2DC\uB3C4 3\uD68C)
5359
+ for attempt in 1 2 3; do
5360
+ osascript <<'APPLESCRIPT' 2>>"$LOG_FILE" && break
5339
5361
  tell application "Terminal"
5340
5362
  activate
5341
5363
  do script "clear; echo ''; cat '$TODAY_FILE'; echo ''; echo '\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500'; echo ''; cd '${config.projectDir}' && ${claudeCmd}"
5342
5364
  end tell
5343
5365
  APPLESCRIPT
5366
+ echo "[$(date)] Terminal launch attempt $attempt failed, retrying..." >> "$LOG_FILE"
5367
+ sleep 10
5368
+ done
5344
5369
  fi
5345
5370
 
5346
5371
  # Linux: Open terminal + Claude Code