@kritchoff/agent-browser 0.9.27 → 0.9.28

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 +22 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kritchoff/agent-browser",
3
- "version": "0.9.27",
3
+ "version": "0.9.28",
4
4
  "description": "Headless browser automation CLI for AI agents",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/sdk.sh CHANGED
@@ -92,6 +92,16 @@ cmd_start() {
92
92
  # === WARM START ===
93
93
  log_success "Found cached baseline snapshot. Performing WARM BOOT..."
94
94
  "$SDK_ROOT/start.sh" --snapshot "$SNAPSHOT_FILE"
95
+
96
+ # Verify port mapping for warm start too
97
+ cd "$SDK_ROOT"
98
+ CONTAINER=$(docker compose ps -q android-service)
99
+ if [ -n "$CONTAINER" ] && ! docker port "$CONTAINER" 3000 >/dev/null 2>&1; then
100
+ log_warn "Port 3000 is not mapped! Container config is stale."
101
+ log_info "Forcing full restart to apply network settings..."
102
+ docker compose -f "$COMPOSE_FILE" down
103
+ "$SDK_ROOT/start.sh" --snapshot "$SNAPSHOT_FILE"
104
+ fi
95
105
  else
96
106
  # === COLD START & FREEZE ===
97
107
  log_warn "No baseline found. Performing FIRST RUN SETUP (Cold Boot)..."
@@ -108,8 +118,6 @@ cmd_start() {
108
118
  exit 1
109
119
  fi
110
120
 
111
- log_info "Creating 'Golden' Baseline Snapshot for future runs..."
112
-
113
121
  # We need to find the container ID to send the adb command
114
122
  # We use docker compose to find it reliably
115
123
  cd "$SDK_ROOT"
@@ -120,6 +128,18 @@ cmd_start() {
120
128
  exit 1
121
129
  fi
122
130
 
131
+ # SELF-HEAL: Verify port 3000 is actually mapped
132
+ # If the container was created with an old config, it might be running without ports.
133
+ if ! docker port "$CONTAINER" 3000 >/dev/null 2>&1; then
134
+ log_warn "Port 3000 is not mapped! Container config is stale."
135
+ log_info "Forcing full restart to apply network settings..."
136
+ docker compose -f "$COMPOSE_FILE" down
137
+ "$SDK_ROOT/start.sh"
138
+
139
+ # Re-fetch container ID after restart
140
+ CONTAINER=$(docker compose ps -q android-service)
141
+ fi
142
+
123
143
  # 1. Save snapshot inside emulator
124
144
  log_info "Saving emulator state (quickboot)..."
125
145
  if docker exec "$CONTAINER" adb emu avd snapshot save quickboot; then