@memtensor/memos-local-openclaw-plugin 0.3.17 → 0.3.19

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 (74) hide show
  1. package/README.md +21 -11
  2. package/dist/capture/index.d.ts +1 -1
  3. package/dist/capture/index.d.ts.map +1 -1
  4. package/dist/capture/index.js +7 -2
  5. package/dist/capture/index.js.map +1 -1
  6. package/dist/index.d.ts +1 -1
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +2 -2
  9. package/dist/index.js.map +1 -1
  10. package/dist/ingest/dedup.d.ts +2 -2
  11. package/dist/ingest/dedup.d.ts.map +1 -1
  12. package/dist/ingest/dedup.js +4 -4
  13. package/dist/ingest/dedup.js.map +1 -1
  14. package/dist/ingest/task-processor.d.ts +1 -1
  15. package/dist/ingest/task-processor.d.ts.map +1 -1
  16. package/dist/ingest/task-processor.js +14 -13
  17. package/dist/ingest/task-processor.js.map +1 -1
  18. package/dist/ingest/worker.d.ts.map +1 -1
  19. package/dist/ingest/worker.js +7 -3
  20. package/dist/ingest/worker.js.map +1 -1
  21. package/dist/recall/engine.d.ts +5 -1
  22. package/dist/recall/engine.d.ts.map +1 -1
  23. package/dist/recall/engine.js +77 -2
  24. package/dist/recall/engine.js.map +1 -1
  25. package/dist/skill/evolver.d.ts +2 -1
  26. package/dist/skill/evolver.d.ts.map +1 -1
  27. package/dist/skill/evolver.js +2 -2
  28. package/dist/skill/evolver.js.map +1 -1
  29. package/dist/skill/generator.d.ts +3 -1
  30. package/dist/skill/generator.d.ts.map +1 -1
  31. package/dist/skill/generator.js +15 -1
  32. package/dist/skill/generator.js.map +1 -1
  33. package/dist/storage/sqlite.d.ts +24 -8
  34. package/dist/storage/sqlite.d.ts.map +1 -1
  35. package/dist/storage/sqlite.js +233 -28
  36. package/dist/storage/sqlite.js.map +1 -1
  37. package/dist/storage/vector.d.ts +1 -1
  38. package/dist/storage/vector.d.ts.map +1 -1
  39. package/dist/storage/vector.js +3 -3
  40. package/dist/storage/vector.js.map +1 -1
  41. package/dist/telemetry.d.ts.map +1 -1
  42. package/dist/telemetry.js +3 -3
  43. package/dist/telemetry.js.map +1 -1
  44. package/dist/types.d.ts +16 -0
  45. package/dist/types.d.ts.map +1 -1
  46. package/dist/types.js.map +1 -1
  47. package/dist/viewer/html.d.ts +1 -1
  48. package/dist/viewer/html.d.ts.map +1 -1
  49. package/dist/viewer/html.js +107 -1
  50. package/dist/viewer/html.js.map +1 -1
  51. package/dist/viewer/server.d.ts +1 -0
  52. package/dist/viewer/server.d.ts.map +1 -1
  53. package/dist/viewer/server.js +52 -3
  54. package/dist/viewer/server.js.map +1 -1
  55. package/index.ts +171 -7
  56. package/package.json +1 -1
  57. package/scripts/postinstall.cjs +31 -15
  58. package/skill/browserwing-admin/SKILL.md +521 -0
  59. package/skill/browserwing-executor/SKILL.md +510 -0
  60. package/skill/memos-memory-guide/SKILL.md +62 -36
  61. package/src/capture/index.ts +7 -1
  62. package/src/index.ts +3 -2
  63. package/src/ingest/dedup.ts +4 -2
  64. package/src/ingest/task-processor.ts +14 -13
  65. package/src/ingest/worker.ts +7 -3
  66. package/src/recall/engine.ts +94 -4
  67. package/src/skill/evolver.ts +3 -1
  68. package/src/skill/generator.ts +15 -0
  69. package/src/storage/sqlite.ts +262 -34
  70. package/src/storage/vector.ts +3 -2
  71. package/src/telemetry.ts +3 -3
  72. package/src/types.ts +18 -0
  73. package/src/viewer/html.ts +107 -1
  74. package/src/viewer/server.ts +48 -3
@@ -191,23 +191,39 @@ try {
191
191
  phase(2, "检查 better-sqlite3 原生模块 / Check native module");
192
192
 
193
193
  const sqliteModulePath = path.join(pluginDir, "node_modules", "better-sqlite3");
194
- const sqliteBuildDir = path.join(sqliteModulePath, "build", "Release");
195
- const sqliteBindingFile = path.join(sqliteBuildDir, "better_sqlite3.node");
194
+
195
+ function findSqliteBinding() {
196
+ const candidates = [
197
+ path.join(sqliteModulePath, "build", "Release", "better_sqlite3.node"),
198
+ path.join(sqliteModulePath, "build", "better_sqlite3.node"),
199
+ path.join(sqliteModulePath, "build", "Debug", "better_sqlite3.node"),
200
+ ];
201
+
202
+ const prebuildDir = path.join(sqliteModulePath, "prebuilds");
203
+ if (fs.existsSync(prebuildDir)) {
204
+ try {
205
+ const platformDir = `${process.platform}-${process.arch}`;
206
+ const pbDir = path.join(prebuildDir, platformDir);
207
+ if (fs.existsSync(pbDir)) {
208
+ const files = fs.readdirSync(pbDir).filter(f => f.endsWith(".node"));
209
+ for (const f of files) candidates.push(path.join(pbDir, f));
210
+ }
211
+ } catch { /* ignore */ }
212
+ }
213
+
214
+ for (const c of candidates) {
215
+ if (fs.existsSync(c)) return c;
216
+ }
217
+ return null;
218
+ }
196
219
 
197
220
  function sqliteBindingsExist() {
198
- if (fs.existsSync(sqliteBindingFile)) return true;
199
- try {
200
- const resolved = require.resolve("better-sqlite3", { paths: [pluginDir] });
201
- log(`Resolved better-sqlite3 at: ${DIM}${resolved}${RESET}`);
202
- if (!resolved.startsWith(pluginDir)) {
203
- warn("Resolved outside plugin dir — treating as missing.");
204
- return false;
205
- }
206
- require(resolved);
221
+ const found = findSqliteBinding();
222
+ if (found) {
223
+ log(`Native binding found: ${DIM}${found}${RESET}`);
207
224
  return true;
208
- } catch {
209
- return false;
210
225
  }
226
+ return false;
211
227
  }
212
228
 
213
229
  if (sqliteBindingsExist()) {
@@ -223,7 +239,7 @@ ${GREEN}${BOLD} ┌────────────────────
223
239
  process.exit(0);
224
240
  } else {
225
241
  warn("better-sqlite3 native bindings not found in plugin dir.");
226
- log(`Expected: ${DIM}${sqliteBindingFile}${RESET}`);
242
+ log(`Searched in: ${DIM}${sqliteModulePath}/build/${RESET}`);
227
243
  log("Running: npm rebuild better-sqlite3 (may take 30-60s)...");
228
244
  }
229
245
 
@@ -257,7 +273,7 @@ ${GREEN}${BOLD} ┌────────────────────
257
273
  process.exit(0);
258
274
  } else {
259
275
  fail(`Rebuild completed but bindings still missing (${elapsed}s).`);
260
- fail(`Looked in: ${sqliteBuildDir}`);
276
+ fail(`Looked in: ${sqliteModulePath}/build/`);
261
277
  }
262
278
  } else {
263
279
  fail(`Rebuild failed with exit code ${result.status} (${elapsed}s).`);
@@ -0,0 +1,521 @@
1
+ ---
2
+ name: browserwing-admin
3
+ description: Manage and operate BrowserWing — an intelligent browser automation platform. Install dependencies, configure LLM, create/manage/execute automation scripts, use AI-driven exploration to generate scripts, browse the script marketplace, and troubleshoot issues.
4
+ ---
5
+
6
+ # BrowserWing Admin Skill
7
+
8
+ ## Overview
9
+
10
+ BrowserWing is an intelligent browser automation platform that allows you to:
11
+ - Record, create, and replay browser automation scripts
12
+ - Use AI to autonomously explore websites and generate replayable scripts
13
+ - Execute scripts via HTTP API or MCP protocol
14
+ - Manage LLM configurations for AI-powered features
15
+
16
+ **API Base URL:** `http://localhost:8080/api/v1`
17
+
18
+ **Authentication:** Use `X-BrowserWing-Key: <api-key>` header or `Authorization: Bearer <token>`
19
+
20
+ ---
21
+
22
+ ## 1. Installing Google Chrome (Prerequisite)
23
+
24
+ BrowserWing requires Google Chrome to be installed on the host machine.
25
+
26
+ ### Linux (Debian/Ubuntu)
27
+ ```bash
28
+ wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
29
+ echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee /etc/apt/sources.list.d/google-chrome.list
30
+ sudo apt-get update
31
+ sudo apt-get install -y google-chrome-stable
32
+ ```
33
+
34
+ ### macOS
35
+ ```bash
36
+ brew install --cask google-chrome
37
+ ```
38
+
39
+ ### Windows
40
+ Download and install from: https://www.google.com/chrome/
41
+
42
+ ### Verify Installation
43
+ ```bash
44
+ google-chrome --version
45
+ # or on macOS:
46
+ # /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --version
47
+ ```
48
+
49
+ ### Using Remote Chrome (Alternative)
50
+ If Chrome is running on a remote machine with debugging enabled:
51
+ ```bash
52
+ google-chrome --remote-debugging-port=9222 --remote-debugging-address=0.0.0.0 --no-sandbox
53
+ ```
54
+ Then configure BrowserWing's `config.toml`:
55
+ ```toml
56
+ [browser]
57
+ control_url = 'http://<remote-host>:9222'
58
+ ```
59
+
60
+ ---
61
+
62
+ ## 2. LLM Configuration
63
+
64
+ AI features (AI Explorer, Agent chat, smart extraction) require an LLM configuration.
65
+
66
+ ### List LLM Configs
67
+ ```bash
68
+ curl -X GET 'http://localhost:8080/api/v1/llm-configs'
69
+ ```
70
+
71
+ ### Add LLM Config
72
+ ```bash
73
+ curl -X POST 'http://localhost:8080/api/v1/llm-configs' \
74
+ -H 'Content-Type: application/json' \
75
+ -d '{
76
+ "name": "my-openai",
77
+ "provider": "openai",
78
+ "api_key": "sk-xxx",
79
+ "model": "gpt-4o",
80
+ "base_url": "https://api.openai.com/v1",
81
+ "is_active": true,
82
+ "is_default": true
83
+ }'
84
+ ```
85
+ **Supported providers:** `openai`, `anthropic`, `deepseek`, or any OpenAI-compatible endpoint.
86
+
87
+ ### Test LLM Config
88
+ ```bash
89
+ curl -X POST 'http://localhost:8080/api/v1/llm-configs/test' \
90
+ -H 'Content-Type: application/json' \
91
+ -d '{"name": "my-openai"}'
92
+ ```
93
+
94
+ ### Update LLM Config
95
+ ```bash
96
+ curl -X PUT 'http://localhost:8080/api/v1/llm-configs/<config-id>' \
97
+ -H 'Content-Type: application/json' \
98
+ -d '{"api_key": "sk-new-key", "model": "gpt-4o-mini"}'
99
+ ```
100
+
101
+ ### Delete LLM Config
102
+ ```bash
103
+ curl -X DELETE 'http://localhost:8080/api/v1/llm-configs/<config-id>'
104
+ ```
105
+
106
+ ---
107
+
108
+ ## 3. AI Autonomous Exploration (Generate Scripts Automatically)
109
+
110
+ Use AI to browse a website, perform a task, and automatically generate a replayable script.
111
+
112
+ ### Start Exploration
113
+ ```bash
114
+ curl -X POST 'http://localhost:8080/api/v1/ai-explore/start' \
115
+ -H 'Content-Type: application/json' \
116
+ -d '{
117
+ "task_desc": "Go to bilibili.com, search for 'AI', and get the first page of video results",
118
+ "start_url": "https://www.bilibili.com",
119
+ "llm_config_id": "my-openai"
120
+ }'
121
+ ```
122
+ **Response:** Returns a session `id` for tracking.
123
+
124
+ ### Stream Exploration Events (SSE)
125
+ ```bash
126
+ curl -N 'http://localhost:8080/api/v1/ai-explore/<session-id>/stream'
127
+ ```
128
+ Returns real-time Server-Sent Events: `thinking`, `tool_call`, `progress`, `error`, `script_ready`, `done`.
129
+
130
+ ### Stop Exploration
131
+ ```bash
132
+ curl -X POST 'http://localhost:8080/api/v1/ai-explore/<session-id>/stop'
133
+ ```
134
+
135
+ ### Get Generated Script
136
+ ```bash
137
+ curl -X GET 'http://localhost:8080/api/v1/ai-explore/<session-id>/script'
138
+ ```
139
+
140
+ ### Save Generated Script
141
+ ```bash
142
+ curl -X POST 'http://localhost:8080/api/v1/ai-explore/<session-id>/save'
143
+ ```
144
+ Saves the generated script to the local script library for future replay.
145
+
146
+ ---
147
+
148
+ ## 4. Script Management
149
+
150
+ ### List All Scripts
151
+ ```bash
152
+ curl -X GET 'http://localhost:8080/api/v1/scripts'
153
+ ```
154
+ Returns all local scripts with their `id`, `name`, `description`, `actions`, `tags`, `group`, etc.
155
+
156
+ ### Get Script Details
157
+ ```bash
158
+ curl -X GET 'http://localhost:8080/api/v1/scripts/<script-id>'
159
+ ```
160
+
161
+ ### Get Script Schema / Summary
162
+ ```bash
163
+ curl -X GET 'http://localhost:8080/api/v1/scripts/summary'
164
+ ```
165
+ Returns a concise summary of all scripts, including names, descriptions, input parameters (variables), and action counts. Useful for programmatic discovery.
166
+
167
+ ### Create a New Script
168
+ ```bash
169
+ curl -X POST 'http://localhost:8080/api/v1/scripts' \
170
+ -H 'Content-Type: application/json' \
171
+ -d '{
172
+ "name": "Search Bilibili",
173
+ "description": "Search for a keyword on Bilibili",
174
+ "url": "https://www.bilibili.com",
175
+ "actions": [
176
+ {"type": "navigate", "url": "https://www.bilibili.com"},
177
+ {"type": "click", "identifier": ".nav-search-input"},
178
+ {"type": "type", "identifier": ".nav-search-input", "value": "${keyword}"},
179
+ {"type": "press_key", "key": "Enter"},
180
+ {"type": "wait", "timeout": 3}
181
+ ]
182
+ }'
183
+ ```
184
+ **Variables:** Use `${variable_name}` syntax in action values. These become input parameters when the script is executed.
185
+
186
+ ### Update a Script
187
+ ```bash
188
+ curl -X PUT 'http://localhost:8080/api/v1/scripts/<script-id>' \
189
+ -H 'Content-Type: application/json' \
190
+ -d '{"name": "Updated Name", "description": "Updated description"}'
191
+ ```
192
+
193
+ ### Delete a Script
194
+ ```bash
195
+ curl -X DELETE 'http://localhost:8080/api/v1/scripts/<script-id>'
196
+ ```
197
+
198
+ ### Export Scripts as Skill (Convert to SKILL.md)
199
+
200
+ Convert one or more scripts into a SKILL.md file that can be imported by AI agents (e.g., Claude, Cursor). This allows other AI agents to discover and execute your BrowserWing scripts.
201
+
202
+ #### Export Selected Scripts
203
+ ```bash
204
+ curl -X POST 'http://localhost:8080/api/v1/scripts/export/skill' \
205
+ -H 'Content-Type: application/json' \
206
+ -d '{
207
+ "script_ids": ["script-id-1", "script-id-2", "script-id-3"]
208
+ }'
209
+ ```
210
+ Merges multiple scripts into a single SKILL.md with all their actions, variables, and descriptions.
211
+
212
+ #### Export All Scripts
213
+ ```bash
214
+ curl -X POST 'http://localhost:8080/api/v1/scripts/export/skill' \
215
+ -H 'Content-Type: application/json' \
216
+ -d '{"script_ids": []}'
217
+ ```
218
+ Pass an empty `script_ids` array to export **all** scripts into one SKILL.md.
219
+
220
+ #### Export Executor Skill (Browser Control API)
221
+ ```bash
222
+ curl -X GET 'http://localhost:8080/api/v1/executor/export/skill'
223
+ ```
224
+ Exports the low-level browser automation API as a skill, allowing an AI agent to directly control the browser (navigate, click, type, extract, etc.).
225
+
226
+ **Workflow: Script → Skill → AI Agent**
227
+ ```
228
+ 1. Create scripts (manually, by recording, or via AI exploration)
229
+ 2. Export them as SKILL.md: POST /scripts/export/skill
230
+ 3. Place the SKILL.md in your AI agent's skill directory
231
+ 4. The AI agent can now discover and call your scripts via POST /scripts/<id>/play
232
+ ```
233
+
234
+ ---
235
+
236
+ ## 5. Execute Scripts
237
+
238
+ ### Run a Script by ID
239
+ ```bash
240
+ curl -X POST 'http://localhost:8080/api/v1/scripts/<script-id>/play' \
241
+ -H 'Content-Type: application/json' \
242
+ -d '{
243
+ "variables": {
244
+ "keyword": "deepseek"
245
+ }
246
+ }'
247
+ ```
248
+ **Variables:** Pass values for `${variable_name}` placeholders defined in the script actions.
249
+
250
+ ### Get Play Result (Extracted Data)
251
+ ```bash
252
+ curl -X GET 'http://localhost:8080/api/v1/scripts/play/result'
253
+ ```
254
+ Returns data extracted during the last script execution (e.g., scraped content from `execute_js` actions).
255
+
256
+ ### List Script Execution History
257
+ ```bash
258
+ curl -X GET 'http://localhost:8080/api/v1/script-executions?page=1&page_size=20'
259
+ ```
260
+
261
+ ---
262
+
263
+ ## 6. Script Marketplace (Remote Scripts)
264
+
265
+ *Note: The remote script marketplace feature is under development. The following APIs may not be available yet.*
266
+
267
+ ### Browse Marketplace
268
+ ```bash
269
+ # TODO: curl -X GET 'http://localhost:8080/api/v1/marketplace/scripts?category=search&page=1'
270
+ ```
271
+
272
+ ### Install Script from Marketplace
273
+ ```bash
274
+ # TODO: curl -X POST 'http://localhost:8080/api/v1/marketplace/scripts/<remote-id>/install'
275
+ ```
276
+
277
+ ---
278
+
279
+ ## 7. MCP (Model Context Protocol) Integration
280
+
281
+ BrowserWing exposes an MCP-compatible endpoint for AI agent integrations.
282
+
283
+ ### MCP SSE Endpoint
284
+ ```
285
+ SSE: http://localhost:8080/api/v1/mcp/sse
286
+ Message: http://localhost:8080/api/v1/mcp/sse_message
287
+ ```
288
+
289
+ ### Check MCP Status
290
+ ```bash
291
+ curl -X GET 'http://localhost:8080/api/v1/mcp/status'
292
+ ```
293
+
294
+ ### List MCP Commands
295
+ ```bash
296
+ curl -X GET 'http://localhost:8080/api/v1/mcp/commands'
297
+ ```
298
+ Shows all registered MCP tools (browser tools + script-based custom commands).
299
+
300
+ ---
301
+
302
+ ## 8. Prompt Management
303
+
304
+ System prompts control AI behavior. Users can customize them.
305
+
306
+ ### List All Prompts
307
+ ```bash
308
+ curl -X GET 'http://localhost:8080/api/v1/prompts'
309
+ ```
310
+
311
+ ### Get a Specific Prompt
312
+ ```bash
313
+ curl -X GET 'http://localhost:8080/api/v1/prompts/<prompt-id>'
314
+ ```
315
+ **System prompt IDs:** `system-extractor`, `system-formfiller`, `system-aiagent`, `system-get-mcp-info`, `system-ai-explorer`
316
+
317
+ ### Update a Prompt
318
+ ```bash
319
+ curl -X PUT 'http://localhost:8080/api/v1/prompts/<prompt-id>' \
320
+ -H 'Content-Type: application/json' \
321
+ -d '{"content": "Your custom prompt content here..."}'
322
+ ```
323
+
324
+ ---
325
+
326
+ ## 9. Browser Instance Management
327
+
328
+ ### List Browser Instances
329
+ ```bash
330
+ curl -X GET 'http://localhost:8080/api/v1/browser/instances'
331
+ ```
332
+
333
+ ### Start a Browser Instance
334
+ ```bash
335
+ curl -X POST 'http://localhost:8080/api/v1/browser/instances/<id>/start'
336
+ ```
337
+
338
+ ### Stop a Browser Instance
339
+ ```bash
340
+ curl -X POST 'http://localhost:8080/api/v1/browser/instances/<id>/stop'
341
+ ```
342
+
343
+ ---
344
+
345
+ ## 10. Cookie Management
346
+
347
+ Manage browser cookies — view saved cookies, import cookies (e.g., for authenticated sessions), and delete cookies.
348
+
349
+ ### View Saved Cookies
350
+ ```bash
351
+ curl -X GET 'http://localhost:8080/api/v1/cookies/browser'
352
+ ```
353
+ Returns all cookies saved under the `browser` store ID (the default store). Replace `browser` with a custom store ID if needed.
354
+
355
+ ### Save Current Browser Cookies
356
+ ```bash
357
+ curl -X POST 'http://localhost:8080/api/v1/browser/cookies/save'
358
+ ```
359
+ Saves all cookies from the current browser session to the database. Requires the browser to be running.
360
+
361
+ ### Import Cookies
362
+ ```bash
363
+ curl -X POST 'http://localhost:8080/api/v1/browser/cookies/import' \
364
+ -H 'Content-Type: application/json' \
365
+ -d '{
366
+ "url": "https://example.com",
367
+ "cookies": [
368
+ {
369
+ "name": "session_id",
370
+ "value": "abc123",
371
+ "domain": ".example.com",
372
+ "path": "/",
373
+ "secure": true,
374
+ "httpOnly": true,
375
+ "sameSite": "Lax",
376
+ "expires": 1735689600
377
+ }
378
+ ]
379
+ }'
380
+ ```
381
+ **Fields:** `name` and `value` are required. `domain`, `path`, `secure`, `httpOnly`, `sameSite`, `expires` are optional (`path` defaults to `/`).
382
+
383
+ ### Delete a Single Cookie
384
+ ```bash
385
+ curl -X POST 'http://localhost:8080/api/v1/browser/cookies/delete' \
386
+ -H 'Content-Type: application/json' \
387
+ -d '{
388
+ "id": "browser",
389
+ "name": "session_id",
390
+ "domain": ".example.com",
391
+ "path": "/"
392
+ }'
393
+ ```
394
+ Deletes a specific cookie identified by `name` + `domain` + `path` from the given cookie store.
395
+
396
+ ### Batch Delete Cookies
397
+ ```bash
398
+ curl -X POST 'http://localhost:8080/api/v1/browser/cookies/batch/delete' \
399
+ -H 'Content-Type: application/json' \
400
+ -d '{
401
+ "id": "browser",
402
+ "cookies": [
403
+ {"name": "session_id", "domain": ".example.com", "path": "/"},
404
+ {"name": "tracking", "domain": ".example.com", "path": "/"}
405
+ ]
406
+ }'
407
+ ```
408
+ Deletes multiple cookies at once. Each cookie is identified by `name` + `domain` + `path`.
409
+
410
+ ---
411
+
412
+ ## 11. Troubleshooting
413
+
414
+ When something goes wrong, follow these steps to diagnose issues.
415
+
416
+ ### Check Service Health
417
+ ```bash
418
+ curl -X GET 'http://localhost:8080/health'
419
+ ```
420
+
421
+ ### View Logs
422
+ BrowserWing logs are stored in the path configured in `config.toml` under `[log] file`.
423
+ Default location: `./log/browserwing.log`
424
+
425
+ ```bash
426
+ # View last 100 lines of logs
427
+ tail -n 100 ./log/browserwing.log
428
+
429
+ # Follow logs in real-time
430
+ tail -f ./log/browserwing.log
431
+
432
+ # Search for errors
433
+ grep -i 'error\|fail\|panic' ./log/browserwing.log | tail -20
434
+ ```
435
+
436
+ ### Common Issues
437
+
438
+ **1. Browser won't start**
439
+ - Check if Google Chrome is installed: `google-chrome --version`
440
+ - On Linux, ensure `--no-sandbox` flag or run as non-root
441
+ - Check for lingering Chrome lock files in user data dir (SingletonLock, lockfile)
442
+ - If using remote Chrome, verify the `control_url` in `config.toml`
443
+ - Try killing existing Chrome processes: `pkill -f chrome`
444
+
445
+ **2. AI features not working**
446
+ - Ensure LLM config is set up and active: `GET /api/v1/llm-configs`
447
+ - Test the LLM connection: `POST /api/v1/llm-configs/test`
448
+ - Check API key validity and model availability
449
+ - Check logs for LLM-related errors
450
+
451
+ **3. Script execution fails**
452
+ - Verify the script exists: `GET /api/v1/scripts/<id>`
453
+ - Check if the browser is running: `GET /api/v1/browser/instances`
454
+ - Review execution history: `GET /api/v1/script-executions`
455
+ - Ensure all required `${variables}` are provided in the play request
456
+ - Target website may have changed — try re-recording or updating the script
457
+
458
+ **4. Page elements not found**
459
+ - Use `GET /api/v1/executor/snapshot` to see current page elements
460
+ - Elements may have dynamic selectors — prefer RefIDs from snapshot
461
+ - Page may not have finished loading — use wait actions
462
+
463
+ **5. Port conflicts**
464
+ - BrowserWing default port: 8080 (configurable in `config.toml` under `[server] port`)
465
+ - Chrome debugging port: 9222 (or as configured in `control_url`)
466
+ - Check for port usage: `lsof -i :<port>` or `netstat -tlnp | grep <port>`
467
+
468
+ ---
469
+
470
+ ## Quick Start Workflow
471
+
472
+ Here's how to get up and running:
473
+
474
+ ```
475
+ 1. Install Chrome (see Section 1)
476
+ 2. Start BrowserWing: ./browserwing --port 8080
477
+ 3. Add an LLM config (see Section 2)
478
+ 4. Choose your approach:
479
+ a) AI Exploration: POST /ai-explore/start with a task description
480
+ b) Manual Creation: POST /scripts with actions array
481
+ c) Web UI: Open http://<host>:8080 in browser to use the visual editor
482
+ 5. Execute scripts: POST /scripts/<id>/play
483
+ 6. View results: GET /scripts/play/result
484
+ ```
485
+
486
+ ## API Quick Reference
487
+
488
+ | Category | Method | Endpoint | Description |
489
+ |----------|--------|----------|-------------|
490
+ | Health | GET | `/health` | Check service status |
491
+ | LLM | GET | `/api/v1/llm-configs` | List LLM configurations |
492
+ | LLM | POST | `/api/v1/llm-configs` | Add LLM configuration |
493
+ | LLM | POST | `/api/v1/llm-configs/test` | Test LLM connection |
494
+ | Explore | POST | `/api/v1/ai-explore/start` | Start AI exploration |
495
+ | Explore | GET | `/api/v1/ai-explore/:id/stream` | Stream exploration events |
496
+ | Explore | POST | `/api/v1/ai-explore/:id/stop` | Stop exploration |
497
+ | Explore | POST | `/api/v1/ai-explore/:id/save` | Save generated script |
498
+ | Scripts | GET | `/api/v1/scripts` | List all scripts |
499
+ | Scripts | GET | `/api/v1/scripts/:id` | Get script details |
500
+ | Scripts | POST | `/api/v1/scripts` | Create new script |
501
+ | Scripts | PUT | `/api/v1/scripts/:id` | Update script |
502
+ | Scripts | DELETE | `/api/v1/scripts/:id` | Delete script |
503
+ | Scripts | GET | `/api/v1/scripts/summary` | Get scripts schema/summary |
504
+ | Scripts | POST | `/api/v1/scripts/export/skill` | Export scripts as SKILL.md |
505
+ | Execute | POST | `/api/v1/scripts/:id/play` | Execute a script |
506
+ | Execute | GET | `/api/v1/scripts/play/result` | Get execution result data |
507
+ | Execute | GET | `/api/v1/script-executions` | List execution history |
508
+ | Prompts | GET | `/api/v1/prompts` | List all prompts |
509
+ | Prompts | PUT | `/api/v1/prompts/:id` | Update prompt |
510
+ | Browser | GET | `/api/v1/browser/instances` | List browser instances |
511
+ | Cookies | GET | `/api/v1/cookies/:id` | View saved cookies |
512
+ | Cookies | POST | `/api/v1/browser/cookies/save` | Save current browser cookies |
513
+ | Cookies | POST | `/api/v1/browser/cookies/import` | Import cookies |
514
+ | Cookies | POST | `/api/v1/browser/cookies/delete` | Delete a single cookie |
515
+ | Cookies | POST | `/api/v1/browser/cookies/batch/delete` | Batch delete cookies |
516
+ | MCP | GET | `/api/v1/mcp/status` | MCP server status |
517
+ | MCP | GET | `/api/v1/mcp/commands` | List MCP commands |
518
+ | Executor | GET | `/api/v1/executor/help` | Executor API help |
519
+ | Executor | GET | `/api/v1/executor/snapshot` | Page accessibility snapshot |
520
+ | Skill | GET | `/api/v1/executor/export/skill` | Export Executor skill |
521
+ | Skill | GET | `/api/v1/admin/export/skill` | Export this Admin skill |