@trawlme/skills 1.4.4 → 1.4.6
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/package.json
CHANGED
|
@@ -48,7 +48,7 @@ CI-relevant env vars. The first three are per-invocation session overrides — t
|
|
|
48
48
|
|
|
49
49
|
All commands accept `--json` (where listed) for machine-readable or pipeable output.
|
|
50
50
|
|
|
51
|
-
Since CLI **v2.0.0** the agent-facing verbs are also top-level: `trawl list / get / run / data /
|
|
51
|
+
Since CLI **v2.0.0** the agent-facing verbs are also top-level: `trawl list / get / run / data / runs / run-info / trigger / whoami / ping / create` (`runs` is named `history` before CLI 3.14.0; `history` still works as an alias) (the `trawl scraps <verb>` paths below still work as aliases — zero breaking change, except `trawl fetch`, removed in 2.0.0, see the AI-wizard `create` below which replaced it).
|
|
52
52
|
|
|
53
53
|
### Create a scrap from a URL + a prompt (AI wizard — the flagship)
|
|
54
54
|
|
|
@@ -59,14 +59,14 @@ trawl create --url https://example.com/products --prompt "track product prices"
|
|
|
59
59
|
|
|
60
60
|
Optional flags: `--no-autofix` (skip the auto-fix retry on a failed first run), `--json` (raw API payload on stdout), `--url <url>` (**since 2.1.0**) — an alias of the positional `url` argument, for callers that prefer a named flag. Exactly one URL is required: pass the positional OR `--url`, never neither. Passing both is fine only when they're identical; two *different* URLs is a usage error (exit 2) rather than the CLI silently picking one.
|
|
61
61
|
|
|
62
|
-
One call: the server generates the extraction code (AI), creates a **persistent, self-healing scrap**, and triggers its first run (auto-fix on failure by default). Requires an api-key scoped `trawl:scraps:create` (or a session JWT). Response: `{ success, scrap, historyId }
|
|
62
|
+
One call: the server generates the extraction code (AI), creates a **persistent, self-healing scrap**, and triggers its first run (auto-fix on failure by default). Requires an api-key scoped `trawl:scraps:create` (or a session JWT). Response: `{ success, scrap, historyId }` — newer servers also send `runId`, the same value (prefer `runId`, fall back to `historyId`).
|
|
63
63
|
|
|
64
64
|
Critical semantics for agents:
|
|
65
65
|
- **Ask the user before running it** — `trawl create` sends the URL + prompt to Trawl, creates a persistent scrap, enables a DAILY schedule, and consumes quota (LLM generation + a real run). Obtain explicit user confirmation immediately before executing; never fire it speculatively.
|
|
66
66
|
- **NOT idempotent + not instant** — generation + first run legitimately takes 30-250s (the CLI already uses the 300s long-run timeout; a global `TRAWL_TIMEOUT` override clamps it). On a client-side timeout the scrap **may still have been created server-side**: run `trawl list` before retrying — a retry creates a DUPLICATE scrap and burns quota.
|
|
67
67
|
- **Daily schedule by default** — a wizard scrap is created with a daily cron (07:00 UTC); it re-runs and meters every day until you change it (`trawl scraps update <id> --cron <expr>` or `--no-cron`).
|
|
68
|
-
- **`success:false` (exit 1) ≠ retry** — the scrap EXISTS and auto-fix is retrying in the background: poll `trawl data <id>` / `trawl run-info <
|
|
69
|
-
- **On success, human mode proves the value (since 2.3.0)** — after a successful first run, `create` prints a small best-effort data sample (item count, field names, one truncated value) below the scrap summary, then `Next step: trawl data <id>` (with `trawl get <id>` noted as the secondary, metadata-only view). The sample is bonus output only: any fetch/parse failure is swallowed silently and never turns a successful create into an error. `--json` is unaffected — it always returns the raw `{ success, scrap, historyId }` payload with no sample appended.
|
|
68
|
+
- **`success:false` (exit 1) ≠ retry** — the scrap EXISTS and auto-fix is retrying in the background: poll `trawl data <id>` / `trawl run-info <runId>`, never re-run `create`.
|
|
69
|
+
- **On success, human mode proves the value (since 2.3.0)** — after a successful first run, `create` prints a small best-effort data sample (item count, field names, one truncated value) below the scrap summary, then `Next step: trawl data <id>` (with `trawl get <id>` noted as the secondary, metadata-only view). The sample is bonus output only: any fetch/parse failure is swallowed silently and never turns a successful create into an error. `--json` is unaffected — it always returns the raw `{ success, scrap, historyId }` payload (plus `runId` on newer servers) with no sample appended.
|
|
70
70
|
- Distinct from `trawl scraps create` below (raw Puppeteer script, no AI).
|
|
71
71
|
|
|
72
72
|
### List scraps
|
|
@@ -143,8 +143,8 @@ trawl scraps update <id> --alert ops@example.com # email on failure
|
|
|
143
143
|
trawl scraps update <id> --no-alert # disable alerts
|
|
144
144
|
trawl scraps update <id> --autofix # enable AI Fix (auto-repair on failure) — @trawlme/cli@1.11.0+
|
|
145
145
|
trawl scraps update <id> --no-autofix # disable AI Fix
|
|
146
|
-
trawl scraps update <id> -p '[{"TRAWL.page":"2"}]' #
|
|
147
|
-
trawl scraps update <id> --params-file ./params.json #
|
|
146
|
+
trawl scraps update <id> -p '[{"TRAWL.page":"2"}]' # scenarios: JSON array of param sets, e.g. [{"TRAWL.<name>":"<value>"}]
|
|
147
|
+
trawl scraps update <id> --params-file ./params.json # scenarios from a file (same array shape)
|
|
148
148
|
trawl scraps update <id> --tier tier2 # request a proxy tier
|
|
149
149
|
trawl scraps update <id> --force-tier tier4 # raise the tier CEILING past the auto-cap
|
|
150
150
|
trawl scraps update <id> --tier tier2 --json # full scrap JSON, or error envelope + exit 1 on refusal
|
|
@@ -152,6 +152,14 @@ trawl scraps update <id> --tier tier2 --json # full scrap JSON, o
|
|
|
152
152
|
|
|
153
153
|
> **GTM seed scraps:** always run `trawl scraps update <id> --autofix --cron '0 0 * * 0'` post-create (weekly schedule + AI Fix enabled).
|
|
154
154
|
|
|
155
|
+
### Params are scenarios
|
|
156
|
+
|
|
157
|
+
- Params stored on a scrap (`-p` / `--params-file`) are **scenarios**: an array of param sets. Each scheduled, dashboard or `trawl run` run picks **one set at random** — never "the last saved set". Put everything a run needs in each set; sets are alternatives, not additions.
|
|
158
|
+
- To run with your own values instead, use `trawl trigger <id> --param key=value` (repeatable). It is a one-off run: the stored scenarios are left untouched. **Since CLI 3.15.0** — currently on the npm `next` dist-tag (`npm i -g @trawlme/cli@next`), not yet on `latest` (3.12.7).
|
|
159
|
+
- Rules: the first stored set defines the schema. Keys are that set's keys, `TRAWL.` prefix optional. Values are typed like the stored value: number, `true`/`false`, or string. Every key is required; blank values and unknown, duplicate or wrongly typed keys are refused with exit 2 (a number error says `must be a number`, a boolean one `must be true or false`; unknown or missing keys list the expected keys). Works with `--wait`, `--watch` and the async default.
|
|
160
|
+
- A scrap without stored params takes no `--param`. A scrap that has params and is triggered without `--param` fails (422 under `--wait`; async, it is acked as queued and the run then fails).
|
|
161
|
+
- `--param` reads the scrap first, so an API key needs `trawl:scraps:read` besides `trawl:scraps:run`. On a scrap without a cron, `trigger` prints a stderr warning that nothing runs it unattended.
|
|
162
|
+
|
|
155
163
|
### Proxy tiers
|
|
156
164
|
|
|
157
165
|
- `--tier tier0..tier4` (create + update) — requests a starting proxy tier. It's **clamped to tier3** if the target domain isn't allow-listed for tier4, even though the flag accepts `tier4` without error.
|
|
@@ -167,6 +175,7 @@ trawl scraps update <id> --tier tier2 --json # full scrap JSON, o
|
|
|
167
175
|
- `trawl scraps run <id> --watch` — same, then polls for progress (since CLI 1.18.4 — see below; it does **not** stream)
|
|
168
176
|
- `trawl scraps trigger <id>` — **async by default**: queues the worker run and returns immediately (no waiting on the 30-250s run)
|
|
169
177
|
- `trawl scraps trigger <id> --wait` — synchronous: block until the run completes (legacy behaviour). Same 300s timeout as `run`, since CLI 1.18.4.
|
|
178
|
+
- `trawl scraps trigger <id> --param key=value` — one-off run with your own param values, see "Params are scenarios" (CLI 3.15.0+, `next` tag)
|
|
170
179
|
- `trawl scraps trigger <id> --watch` — queue, then poll for progress (since CLI 1.18.4 — see below; it does **not** stream)
|
|
171
180
|
- `trawl scraps watch <id>` — the standalone command: attach to an in-progress run's activity stream over SSE. **Unchanged** by any of the above — this is the one that actually streams.
|
|
172
181
|
|
|
@@ -180,14 +189,14 @@ Control flow depends on the path: for a **synchronous** run (`run`, or `trigger
|
|
|
180
189
|
### Inspect past runs
|
|
181
190
|
|
|
182
191
|
```bash
|
|
183
|
-
trawl scraps
|
|
184
|
-
trawl scraps
|
|
185
|
-
trawl scraps
|
|
186
|
-
trawl scraps run-info <
|
|
187
|
-
trawl scraps run-info <
|
|
192
|
+
trawl scraps runs <id> # table of recent runs (status, time, tier, failureKind)
|
|
193
|
+
trawl scraps runs <id> --json # JSON array, newest first
|
|
194
|
+
trawl scraps runs <id> --limit 50 # cap rows (default 20)
|
|
195
|
+
trawl scraps run-info <runId> # one run's detail by its run id (status, tier, failureKind, error + selector)
|
|
196
|
+
trawl scraps run-info <runId> --json
|
|
188
197
|
```
|
|
189
198
|
|
|
190
|
-
`doctor`/`autofix` (below) inspect the **last** run; `
|
|
199
|
+
`runs` needs CLI ≥ 3.14.0 (on older installs, use `history`); `history` still works as an alias on every version. A run id and a history id are the same value — in the table and in `--json` rows the field is still named `hid`. `doctor`/`autofix` (below) inspect the **last** run; `runs` + `run-info` reach **any** run: list with `runs`, then pass a row's `hid` to `run-info` for the full diagnosis. `run-info` hits `/api/historys/:hid`, which returns the proxy tier + `failureKind` to the scrap owner, plus the error snapshot (`errorMessage`/selector context) that `runs`' embedded list never carries. (On servers released before mid-July 2026, `runs` also shows the tier/failureKind columns blank — `run-info` always has them.)
|
|
191
200
|
|
|
192
201
|
### Delete
|
|
193
202
|
|
|
@@ -315,7 +324,7 @@ Scrap object shape:
|
|
|
315
324
|
}
|
|
316
325
|
```
|
|
317
326
|
|
|
318
|
-
There is **no `lastRun` field** — that never existed. Last-run status/timing/error all derive from `history[0]` (newest first). The embedded row shape differs by command:
|
|
327
|
+
There is **no `lastRun` field** — that never existed. Last-run status/timing/error all derive from `history[0]` (newest first). Newer servers also send the same array as `runs` — read `runs ?? history`. The embedded row shape differs by command:
|
|
319
328
|
- `trawl scraps get <id>` — up to 100 rows, each with `status`, `statusDetail`, `time`, `proxyTier`, `failureKind`, `blockType`, `createdAt`
|
|
320
329
|
- `trawl scraps list` — only the single newest row per scrap, with just `status` / `statusDetail` / `createdAt` (no `time`/`proxyTier`/`failureKind`/`blockType` — those come back `undefined`, not `null`); fetch `get <id>` if you need the triage fields
|
|
321
330
|
- `status` — tri-state: `true` (success) / `false` (failure) / `null` (in-flight, no result yet)
|
|
@@ -81,9 +81,10 @@ returnData([
|
|
|
81
81
|
## Params
|
|
82
82
|
|
|
83
83
|
- **`TRAWL.url`** — the target URL, set by the scrap schedule. Treat as immutable; never override it.
|
|
84
|
-
- **`TRAWL.<custom>`** —
|
|
85
|
-
-
|
|
86
|
-
- **`
|
|
84
|
+
- **`TRAWL.<custom>`** — a custom parameter of the run. Where it comes from: the scrap's stored params (Settings → Parameters, or `trawl scraps update <id> -p/--params '[{"TRAWL.<name>":"<value>"}]'`, or `--params-file <path>` for bulk — see the `trawl-cli` skill) or the caller's own values (`trawl trigger <id> --param name=value`, CLI 3.15.0+, npm `next` tag for now).
|
|
85
|
+
- **Stored params are scenarios.** The array holds alternative param sets, and each scheduled, dashboard or `trawl run` run receives **one set picked at random**. The script never sees the whole array, so every set must carry every key the script needs. A `--param` run replaces the pick with the caller's values for that run only.
|
|
86
|
+
- **`RANDOM(...)`** — a value generator, unrelated to the scenario pick above: a helper that returns a random value from a list (see Trawl params docs). *Signature not independently re-verified against the worker runtime as part of this pass — treat as provisional.*
|
|
87
|
+
- **`DATE(±N, unit, format)`** — a value generator too: a date helper that returns a formatted date offset from now. *Signature not independently re-verified against the worker runtime as part of this pass — treat as provisional.*
|
|
87
88
|
|
|
88
89
|
Validate inputs early — throw before any network call if a required param is missing.
|
|
89
90
|
|