Skip to content

[API_V1] keenable fetch: several URLs and the v1 options over POST /v1/fetch - #119

Draft
KGKallasmaa wants to merge 5 commits into
mainfrom
api-v1/fetch-post
Draft

KGKallasmaa wants to merge 5 commits into
mainfrom
api-v1/fetch-post

Conversation

@KGKallasmaa

Copy link
Copy Markdown
Contributor

keenable fetch now takes one or more URLs and the v1 Fetch options, sent to POST /v1/fetch.

Do not merge or release until POST /v1/fetch is public. It sits behind the per-org fetch_post flag (backend stack #772 → #773 → #774 → #776 → #777 → #778, plus #775).

Behaviour

  • When POST is used: with more than one URL, or with any of --offset, --no-text, --summary, --schema-file, --highlights [QUERY], --links N, --images N, --max-age, or --timeout.
  • When GET is still used: a single URL with only today's flags (--live, --prompt, --max-chars, --session-id) keeps calling GET /v1/fetch, so nothing changes for current users.
  • Old flags on POST: --prompt becomes the summary instruction, and --live becomes max_age: "0s".
  • --schema-file PATH: must hold a JSON object; it's sent as content.summary.output_schema. A bad file exits 2.
  • Output:
    • YAML mode prints the API response as is.
    • -p prints each page (text, or the summary, pretty-printed when it's JSON), a hint with --offset when there's more text, and one warning per failed URL.
    • Exit code 6 when every URL failed.
  • Transport: the daemon and the direct HTTP path both gain a fetch_post command that POSTs the JSON body. Daemon and client builds must match, so an older daemon refuses the request and gets restarted.

Checks

  • Not built locally: this repo's rule is that Rust builds and tests run on the devbox, and it's unreachable today, so CI (fmt, clippy -D warnings, cargo test) is the build check here.
  • New unit tests: build_fetch_body (defaults, every option, no text with default highlights), every_url_failed and read_schema_file.
  • To do: e2e cases in tests/e2e/test_fetch.py, once the flag is on for the e2e key's org.

Linear: KEE-1403 (Fetch POST) and KEE-1438 (CLI).

🤖 Generated with Claude Code

`keenable fetch` takes one or more URLs. More than one URL, or any of
--offset, --no-text, --summary, --schema-file, --highlights, --links,
--images, --max-age or --timeout, sends POST /v1/fetch (preview, behind the
fetch_post org flag); a single URL with only today's flags keeps using GET.
The daemon and the direct path both gain a fetch_post command. Exit code 6
when every URL failed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
KGKallasmaa and others added 4 commits November 14, 2026 20:21
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
POST /v1/fetch now returns results[i] for urls[i] and puts a failed page's
error on its entry (no top-level errors). The human view warns per entry, and
exit code 6 means every entry failed to read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sends cache_only: true; conflicts with --live and refuses --max-age 0s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant