aboutsummaryrefslogtreecommitdiff
path: root/modules/mu4e-attachments.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-16 05:17:21 -0500
committerCraig Jennings <c@cjennings.net>2026-05-16 05:17:21 -0500
commit99d93203a867294addf4927ceec5644b9d3bf322 (patch)
treef579382868960c77cd38eb350fba4dfdaab13c21 /modules/mu4e-attachments.el
parentceeae9b5e2625e23e6e3792d06a6c8122a36d18b (diff)
downloaddotemacs-99d93203a867294addf4927ceec5644b9d3bf322.tar.gz
dotemacs-99d93203a867294addf4927ceec5644b9d3bf322.zip
feat(gptel-tools): wire web_fetch as a local tool
Fourth ADOPT entry from `docs/design/gptel-tools-shortlist.org'. Lets gptel pull a URL into the conversation so the model can read docs / current API shapes / etc. without me copy-pasting. Shape: - URL must be `http://' or `https://' (file://, ftp://, javascript:, scheme-less, etc. are rejected at the validator). - HTML responses go through `pandoc -f html -t plain' so the model gets a reading shape that isn't full of markup; falls back to `w3m -dump -T text/html' if pandoc isn't on PATH; signals `user-error' if neither is. Pass `raw=t' to skip stripping. - Output capped at 200KB by default, hard cap 1MB; `max_bytes' argument lets the caller pick a lower cap. Truncation reported inline. - 4xx / 5xx response codes signal `error' with the code -- the alternative is returning an error page body, which the model would treat as content. `:confirm t' on the tool because every call is a real outbound network request. The tool's description warns that URLs go wherever the user-agent points, including internal networks if that's what the URL names. `tests/test-gptel-tools-web-fetch.el' -- 20 tests across Normal / Boundary / Error. URL validator covers http / https / non-string / empty / non-http schemes. `--effective-max-bytes' covers default / low-clamp / hard-cap / passthrough. Truncate helper covers under-cap / at-cap / over-cap with the marker. HTML stripper runs against real pandoc / w3m (both installed in dev env, neither should mangle simple markup). Orchestrator stubs `cj/gptel-web-fetch--retrieve' via `cl-letf' to cover normal / raw / 4xx / 5xx / oversize / bad-scheme paths. Wired into `cj/gptel-local-tool-features' so gptel exposes the tool on next restart. Note: `call-process-region' invocation flattened to a single `with-temp-buffer' with DELETE=t -- the initial draft nested a second temp buffer and routed output to the inner one, which got killed before `buffer-string' on the outer ran. Test caught it.
Diffstat (limited to 'modules/mu4e-attachments.el')
0 files changed, 0 insertions, 0 deletions