cli: sift batch submit|status|get|cancel; README and skill

Add `sift batch` so agents reach the batch endpoint through the CLI like
`fetch` and `search`. `batchcmd.go` has `parseBatchArgs` (verb plus the
unchanged args after it; submit takes one arg, status a job id optionally
preceded by `--results`, get a job id plus a non-negative-integer idx, cancel
a job id, else a usage error), `batchMain` dispatch, one small function per
verb, and `batchDo` (bearer header, decode the envelope, print it on stdout,
on non-2xx the error to stderr and `exitFor`). `submitMain` reads the file or
stdin and validates locally: a JSON object with a non-empty `targets` array,
or a bare array of targets or URL strings wrapped into `{"targets": [...]}`.

README gains a "Batch" section (endpoints, serial-per-job/one-worker/
round-robin model, caps, idempotency, lease/TTL/restart, summary-vs-results,
redaction, metrics); SKILL.md gains a "Batch" section.

Co-Authored-By: ornith-1.5-35b-a3b <ornith-1.5-35b-a3b@llama.cpp.invalid>
This commit is contained in:
2026-09-26 23:13:48 -07:00
co-authored by ornith-1.5-35b-a3b
parent 484c33f986
commit be48ecb550
6 changed files with 317 additions and 3 deletions
+27
View File
@@ -55,6 +55,33 @@ Useful flags: `--mode digest|clean|raw` (default `digest` when `--question` is g
else `clean`), `--no-context` (skip Honcho lookup), `--recover` (server-side archive ladder
for blocked pages), `--json` (full envelope: content, source, context, sizes, warnings).
## Batch
When you will read the content of several URLs later (a shortlist to compare), submit them once
instead of a loop of `sift fetch`:
```bash
# one JSON object, or a bare array of URLs
sift batch submit targets.json
# ["https://a", "https://b"] also works; each string becomes {"url": ...}
```
Then poll and read:
```bash
sift batch status <job> # summary: per-target status, no content
sift batch status --results <job> # everything at once — can be large, avoid unless needed
sift batch get <job> <idx> # one target's result, as `sift fetch --json`
sift batch cancel <job> # stop a queued job
```
- Submit once; a retry of the same list from this caller returns the same job (`reused`), it does
not start a second.
- Don't use `--results` unless you need every result at once — a batch of 32 can be several
megabytes. Read each piece with `sift batch get <job> <idx>`.
- A batch is slow on purpose: it runs one target at a time per job. For one URL you need now, use
`sift fetch`.
## PDFs
PDFs work: `sift fetch` extracts them and returns the text. A short one comes back whole; a