Skip to content

armgit / moli

Public Imported from GitHub
0

Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust

docs(skill): strengthen Moli search concurrency and timeouts

ldm062b168045253
diff --git a/skills/moli-websearch/SKILL.md b/skills/moli-websearch/SKILL.md
index c997adb83..4632cd154 100644
--- a/skills/moli-websearch/SKILL.md
+++ b/skills/moli-websearch/SKILL.md
@@ -5,13 +5,38 @@ description: Search the web by keyword or reverse-search images with Moli to fin
# Search the Web with Moli
-Search by keyword or image, then verify useful matches against source pages.
+Search by keyword or image and verify source pages with Moli throughout.
+
+## Parallel Execution
+
+- **Batch first.** Launch 4–6 independent searches together, covering at least
+ 3 suitable engines when available. For broad requests, split the work into
+ independent subquestions and keep 8–12 searches and source fetches in flight.
+ Honor explicit source/budget limits and available work. Regional aliases and
+ DuckDuckGo HTML/Lite count as one engine.
+- **Dispatch before waiting.** Use parallel tool calls or a subprocess pool;
+ refill slots as results arrive. Deduplicate promising URLs and fetch source
+ pages concurrently, without waiting for the slowest search. Keep errors and
+ outputs separate per job so one failure cannot abort the batch. Limit each
+ engine/source host to 2 concurrent requests; reduce load on rate/resource limits.
+- **Recover across engines with Moli.** On CAPTCHA, access errors, timeouts,
+ empty shells, or irrelevant results, queue another suitable engine or route
+ while other jobs continue. Use the full engine tables when needed. Stop
+ expanding once the requested coverage has been verified or the task budget
+ is reached; report remaining gaps.
+- **Keep tool changes explicit.** A single blocked engine is not a reason to
+ switch to built-in search. Switch only if the user requests it, Moli cannot
+ run after setup, or two diversified batches for an unresolved question yield
+ no usable results. Disclose the attempts and tool change; honor Moli-only
+ requests by reporting blockers instead. Track actual Moli search calls
+ separately from source fetches so execution counts can be reported accurately.
## Fast Path
-These routes returned relevant results locally. Choose by language and input;
-availability varies with network and session. Encode the query as `Q` or the
-public image URL as `ENC` once with `encodeURIComponent(...)`.
+These routes returned relevant results locally. Choose several for the first
+batch by language and input; row order is not priority. Availability varies
+with network and session. Encode the query as `Q` or the public image URL as
+`ENC` once with `encodeURIComponent(...)`.
**Text search**
@@ -37,10 +62,12 @@ public image URL as `ENC` once with `encodeURIComponent(...)`.
| Baidu | Local file: [auto-upload and hydrated cards](references/cdp-driver.md#browser-uploads). |
| SauceNAO | Public URL through the [homepage form](references/cdp-driver.md#browser-uploads). |
-Fetch URL routes with:
+Use a 10-second request timeout (`--timeout 10000`) by default for searches
+and source fetches. Extend it only for explicit upload/rendering waits.
+Dispatch the selected jobs concurrently:
```bash
-moli fetch --timeout 25000 --wait-until done --dump markdown "$SEARCH_URL"
+moli fetch --timeout 10000 --wait-until done --dump markdown "$SEARCH_URL"
```
Use `--wait-until domcontentloaded` for Toutiao, Sogou Weixin, and Naver.
@@ -69,14 +96,16 @@ Use `--wait-until domcontentloaded` for Toutiao, Sogou Weixin, and Naver.
[image recipes](references/imagesearch.md) as needed.
3. Expand through the full [web engine](references/websearch-engines.md) or
[image engine](references/imagesearch-engines.md) tables for other scopes,
- languages, inputs, or indexes, or when a route fails. Assess the current
- response; searches can run concurrently.
+ languages, inputs, or indexes, or when a route fails. Follow the
+ [parallel execution rules](#parallel-execution) throughout.
4. Read results as Markdown, inspect HTML for empty page shells, and use JSON
for API responses. Enable layout for interactive uploads or screenshots;
save binary captures to files.
-5. Fetch supporting source pages with `moli fetch --dump markdown`, then cite
- them beside claims. Report useful engines, uncertainty, and failed attempts.
- Use [moli-webfetch](../moli-webfetch/SKILL.md) for advanced retrieval.
+5. Fetch supporting source pages concurrently with
+ `moli fetch --timeout 10000 --dump markdown`, verify coverage of each
+ subquestion, then cite sources beside claims. Report useful engines,
+ uncertainty, and failed attempts. Use
+ [moli-webfetch](../moli-webfetch/SKILL.md) for advanced retrieval.
## Operating Rules
diff --git a/skills/moli-websearch/references/imagesearch.md b/skills/moli-websearch/references/imagesearch.md
index d3fd54639..ac4784129 100644
--- a/skills/moli-websearch/references/imagesearch.md
+++ b/skills/moli-websearch/references/imagesearch.md
@@ -16,16 +16,18 @@ image results such as `tbm=isch` do not establish a reverse-image match.
## Public URL
-Choose a URL method for the relevant index from the engine table. Encode the
-image URL once as the `ENC` query value:
+Launch compatible URL methods from the engine table concurrently under the
+[parallel execution rules](../SKILL.md#parallel-execution). Encode the image URL
+once as the `ENC` query value; each command is one job:
```bash
-moli fetch --timeout 28000 --wait-until done --dump markdown "$SEARCH_URL"
+moli fetch --timeout 10000 --wait-until done --dump markdown "$SEARCH_URL"
```
-An outer `timeout 35s` can bound the process. If only an empty image and “No
-matching results” appear, check image retrieval before treating it as an index
-miss; Wikimedia hotlinks failed in the recorded tests.
+An outer `timeout 15s` allows startup and cleanup around the 10-second request
+timeout. If only an empty image and “No matching results” appear, check image
+retrieval before treating it as an index miss; Wikimedia hotlinks failed in
+the recorded tests.
## Upload and API
@@ -33,6 +35,10 @@ Use the relevant [CDP/API recipe](cdp-driver.md) for file inputs, multipart,
raw bytes, or base64 requests. That guide includes server startup and cleanup;
[moli-cdp-server](../../moli-cdp-server/SKILL.md) covers other CDP clients.
+Run independent engine flows in parallel. In a shared CDP context, create
+targets serially as the driver requires, then run each flow in its own target.
+Keep navigation, upload, and result retrieval ordered within each flow.
+
Assign a file and wait for its automatic upload. An extra search click can
cancel Baidu's request; wait for hydrated result cards as shown in the recipe.
Follow the resulting URL or inspect API data to determine whether matches exist.
diff --git a/skills/moli-websearch/references/websearch.md b/skills/moli-websearch/references/websearch.md
index 08380541d..aac3fd965 100644
--- a/skills/moli-websearch/references/websearch.md
+++ b/skills/moli-websearch/references/websearch.md
@@ -1,20 +1,27 @@
# Keyword search
-Choose a URL from [websearch-engines.md](websearch-engines.md). Replace `Q`
-with the query encoded once using `encodeURIComponent(query)` or
-`urllib.parse.quote(query, safe="")`.
+Build a batch of independent query/engine jobs from
+[websearch-engines.md](websearch-engines.md) using the
+[parallel execution rules](../SKILL.md#parallel-execution). Replace `Q` with
+the query encoded once using `encodeURIComponent(query)` or
+`urllib.parse.quote(query, safe="")`. Split broad requests into subquestions;
+search them concurrently across suitable engines.
## Fetch and Readiness
+This is one job; dispatch the batch before awaiting individual results:
+
```bash
-moli fetch --timeout 25000 --wait-until done --dump markdown "$SEARCH_URL"
+moli fetch --timeout 10000 --wait-until done --dump markdown "$SEARCH_URL"
```
-Keep stderr and exit status separate from result text. An outer `timeout 30s`
-can bound the process. For failed or empty output, try
-`--wait-until domcontentloaded`; for page shells, inspect `--dump html`. Toutiao's
-`snssdk143` shell can need the same readiness change. Persistent requests can
-prevent `networkidle` from completing.
+Keep stdout, stderr, and exit status separate for each job. An outer
+`timeout 15s` can bound the process, allowing startup and cleanup around the
+10-second request timeout. Continue other jobs when one fails. For readiness
+failures or empty output, try `--wait-until domcontentloaded`; for page shells,
+inspect `--dump html`. On a CAPTCHA or access block, queue another engine with
+Moli. Toutiao's `snssdk143` shell can need the same readiness change. Persistent
+requests can prevent `networkidle` from completing.
## Bing Extraction
@@ -22,7 +29,7 @@ Extract result elements with `textContent`; `innerText` depends on layout.
`--eval` and `--eval-file` are alternatives to `--dump`:
```bash
-moli fetch --timeout 25000 --wait-until done --eval '
+moli fetch --timeout 10000 --wait-until done --eval '
Array.from(document.querySelectorAll("li.b_algo")).map((row) => {
const link = row.querySelector("h2 a[href]");
return {
@@ -40,7 +47,8 @@ array, compare with Markdown or HTML before concluding there are no results.
## Capture
-For a requested Bing screenshot, this tested recipe allows time for rendering:
+For a requested Bing screenshot, this tested recipe uses a longer timeout
+for rendering:
```bash
moli fetch --timeout 60000 --delay-ms 30000 --layout --resource \