@kritchoff/agent-browser 0.9.7 → 0.9.8

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/sdk.sh +28 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kritchoff/agent-browser",
3
- "version": "0.9.7",
3
+ "version": "0.9.8",
4
4
  "description": "Headless browser automation CLI for AI agents",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/sdk.sh CHANGED
@@ -48,6 +48,31 @@ log_success() { echo -e "${GREEN}[SDK]${NC} $1"; }
48
48
  log_warn() { echo -e "${YELLOW}[SDK]${NC} $1"; }
49
49
  log_error() { echo -e "${RED}[SDK]${NC} $1"; }
50
50
 
51
+ pull_images_with_retry() {
52
+ # Only pull if we are using the distribution compose file (which uses images)
53
+ if [ "$COMPOSE_FILE" != "docker-compose.sdk.yml" ]; then
54
+ return 0
55
+ fi
56
+
57
+ local max_retries=5
58
+ local count=0
59
+
60
+ log_info "Downloading Agent Environment (this may take a while)..."
61
+
62
+ while [ $count -lt $max_retries ]; do
63
+ if docker compose -f "$COMPOSE_FILE" pull; then
64
+ return 0
65
+ fi
66
+
67
+ count=$((count + 1))
68
+ log_warn "Download failed/interrupted. Retrying ($count/$max_retries)..."
69
+ sleep 5
70
+ done
71
+
72
+ log_error "Failed to download images after $max_retries attempts. Please check your internet connection."
73
+ exit 1
74
+ }
75
+
51
76
  cmd_start() {
52
77
  log_info "Initializing Agent Environment (using $COMPOSE_FILE)..."
53
78
 
@@ -55,6 +80,9 @@ cmd_start() {
55
80
  # Note: start.sh needs to be updated to respect COMPOSE_FILE if it doesn't already
56
81
  export COMPOSE_FILE="$COMPOSE_FILE"
57
82
 
83
+ # Ensure images are present (Production robustness)
84
+ pull_images_with_retry
85
+
58
86
  if [ -f "$SNAPSHOT_FILE" ]; then
59
87
  # === WARM START ===
60
88
  log_success "Found cached baseline snapshot. Performing WARM BOOT..."