@kritchoff/agent-browser 0.9.27 → 0.9.29
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/index.js +1 -1
- package/docker-compose.sdk.yml +4 -4
- package/package.json +1 -1
- package/sdk.sh +26 -2
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import * as net from 'net';
|
|
|
5
5
|
import { randomUUID } from 'crypto';
|
|
6
6
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
7
7
|
const SDK_SCRIPT = path.resolve(__dirname, '../sdk.sh');
|
|
8
|
-
const DAEMON_PORT =
|
|
8
|
+
const DAEMON_PORT = 3001;
|
|
9
9
|
export class WootzAgent {
|
|
10
10
|
options;
|
|
11
11
|
constructor(options = {}) {
|
package/docker-compose.sdk.yml
CHANGED
|
@@ -8,10 +8,10 @@ services:
|
|
|
8
8
|
privileged: true # Required for KVM
|
|
9
9
|
restart: always # Auto-restart on crash
|
|
10
10
|
ports:
|
|
11
|
-
- "
|
|
12
|
-
- "
|
|
13
|
-
- "
|
|
14
|
-
- "
|
|
11
|
+
- "5566:5555" # ADB (Host access)
|
|
12
|
+
- "9235:9224" # CDP (Host access)
|
|
13
|
+
- "6091:6080" # NoVNC
|
|
14
|
+
- "3001:3000" # Agent Control Port (Exposed from shared namespace)
|
|
15
15
|
environment:
|
|
16
16
|
- EMULATOR_NAME=Pixel_6_API_34
|
|
17
17
|
- BROWSER=wootzapp
|
package/package.json
CHANGED
package/sdk.sh
CHANGED
|
@@ -92,6 +92,18 @@ 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" 3001 >/dev/null 2>&1; then
|
|
100
|
+
log_warn "Port 3001 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
|
+
log_info "Waiting for ports to release..."
|
|
104
|
+
sleep 5
|
|
105
|
+
"$SDK_ROOT/start.sh" --snapshot "$SNAPSHOT_FILE"
|
|
106
|
+
fi
|
|
95
107
|
else
|
|
96
108
|
# === COLD START & FREEZE ===
|
|
97
109
|
log_warn "No baseline found. Performing FIRST RUN SETUP (Cold Boot)..."
|
|
@@ -108,8 +120,6 @@ cmd_start() {
|
|
|
108
120
|
exit 1
|
|
109
121
|
fi
|
|
110
122
|
|
|
111
|
-
log_info "Creating 'Golden' Baseline Snapshot for future runs..."
|
|
112
|
-
|
|
113
123
|
# We need to find the container ID to send the adb command
|
|
114
124
|
# We use docker compose to find it reliably
|
|
115
125
|
cd "$SDK_ROOT"
|
|
@@ -120,6 +130,20 @@ cmd_start() {
|
|
|
120
130
|
exit 1
|
|
121
131
|
fi
|
|
122
132
|
|
|
133
|
+
# SELF-HEAL: Verify port 3001 is actually mapped
|
|
134
|
+
# If the container was created with an old config, it might be running without ports.
|
|
135
|
+
if ! docker port "$CONTAINER" 3001 >/dev/null 2>&1; then
|
|
136
|
+
log_warn "Port 3001 is not mapped! Container config is stale."
|
|
137
|
+
log_info "Forcing full restart to apply network settings..."
|
|
138
|
+
docker compose -f "$COMPOSE_FILE" down
|
|
139
|
+
log_info "Waiting for ports to release..."
|
|
140
|
+
sleep 5
|
|
141
|
+
"$SDK_ROOT/start.sh"
|
|
142
|
+
|
|
143
|
+
# Re-fetch container ID after restart
|
|
144
|
+
CONTAINER=$(docker compose ps -q android-service)
|
|
145
|
+
fi
|
|
146
|
+
|
|
123
147
|
# 1. Save snapshot inside emulator
|
|
124
148
|
log_info "Saving emulator state (quickboot)..."
|
|
125
149
|
if docker exec "$CONTAINER" adb emu avd snapshot save quickboot; then
|