fix(amazon-shopping): harden agent invocation
This commit is contained in:
@@ -13,8 +13,7 @@ Verify the browser dependency before live use:
|
||||
|
||||
```bash
|
||||
openclaw skills info web-automation
|
||||
cd ~/.openclaw/workspace/skills/web-automation/scripts
|
||||
node check-install.js
|
||||
node "$HOME/.openclaw/workspace/skills/web-automation/scripts/check-install.js"
|
||||
```
|
||||
|
||||
## Search Products
|
||||
@@ -22,10 +21,11 @@ node check-install.js
|
||||
Run the helper from the installed skill directory:
|
||||
|
||||
```bash
|
||||
cd ~/.openclaw/workspace/skills/amazon-shopping
|
||||
scripts/search-products "<user request>" --json
|
||||
"$HOME/.openclaw/workspace/skills/amazon-shopping/scripts/search-products" '<user request>' --json
|
||||
```
|
||||
|
||||
Use single quotes around product requests that contain dollar amounts so the shell does not expand `$4` or similar text. Use `--limit N`; `--max N` is accepted as a compatibility alias. If your execution tool supports a timeout option, set it to at least 600 seconds for live runs with detail enrichment. Use `--skip-details` only for a quick preview or when the user does not need specifications and delivery details.
|
||||
|
||||
Default to at most 15 products unless the user asks for a different count. For requested counts above 30, ask before continuing or split the request into batches. Always include source URLs, report missing fields explicitly, and do not claim review histogram data unless it was visible and extracted.
|
||||
|
||||
## Guardrails
|
||||
|
||||
@@ -25,7 +25,7 @@ Usage:
|
||||
Options:
|
||||
--json Print JSON output
|
||||
--markdown Print markdown output
|
||||
--limit N Maximum products to return (default: 15)
|
||||
--limit N, --max N Maximum products to return (default: 15)
|
||||
--allow-large-limit Permit limits above 30
|
||||
--min-rating N Minimum rating score
|
||||
--min-reviews N Minimum review count
|
||||
@@ -70,13 +70,14 @@ export function parseCliRequest(argv: string[]): SearchProductsRequest {
|
||||
string: [
|
||||
"query",
|
||||
"limit",
|
||||
"max",
|
||||
"min-rating",
|
||||
"min-reviews",
|
||||
"max-price",
|
||||
"max-unit-price",
|
||||
"max-search-pages"
|
||||
],
|
||||
alias: { h: "help" }
|
||||
alias: { h: "help", max: "limit" }
|
||||
});
|
||||
|
||||
const rawQuery = String(args.query ?? args._.join(" ")).trim();
|
||||
|
||||
@@ -64,6 +64,12 @@ describe("amazon-shopping CLI", () => {
|
||||
assert.equal(parseCliRequest(["usb c cable", "--json", "--markdown"]).output, "both");
|
||||
});
|
||||
|
||||
it("accepts max as a natural agent alias for limit", () => {
|
||||
const request = parseCliRequest(["100w led bulbs", "--max", "5"]);
|
||||
|
||||
assert.equal(request.limit, 5);
|
||||
});
|
||||
|
||||
it("normalizes natural-language filters for the target request", () => {
|
||||
const request = parseCliRequest([
|
||||
"100w led bulbs that cost less than $4 each and have over 200 reviews with a review score of more than 4.5 stars",
|
||||
|
||||
Reference in New Issue
Block a user