]> git.ekhem.eu.org Git - guix.git/commit
[proxy] Simplify claude-proxy implementation and shrink the file.
authorJakub Czajka <jakub@ekhem.eu.org>
Sun, 6 Sep 2026 12:12:17 +0000 (12:12 +0000)
committerJakub Czajka <jakub@ekhem.eu.org>
Sun, 6 Sep 2026 17:14:18 +0000 (17:14 +0000)
commit9dc914c5e078e77e8b3e6a6dfc8876282b772e50
tree58a07c592ff6247c82b57960c4510362704f235b
parent74e3742fbda8f1ab1926ec08fb429797e8783d95
[proxy] Simplify claude-proxy implementation and shrink the file.

Replace the proxy-wrapper launch wrapper with with-extensions on the
program-file: gexp->script then emits an expansion-time prologue that
puts the off-prefix (gnutls) and (json) module directories on the load
paths, so the generated script runs with no GUILE_LOAD_PATH plumbing.

Read all configuration from the environment in one block at the top of
the script body, hoisting the orphan-watchdog interval next to the
port, upstream and timeout reads, and document the contract in the
header.

Fold duplicated idioms without changing behavior: req-log via log, a
deadline-ms helper, one select in wait!, flat put-strings in
send-simple, a regex chunk-size parser, the abort-message case inside
emit-error-frame, an optional-header helper in forward, body-allowed?
inlined into serve-one, and the relay close path flattened.  Trim
docstrings that restate adjacent comments and drop the unused imports
(guix packages) and (ice-9 receive).

The claude-proxy tests stay green: the full VM suite passes 41/41,
covering the deadline and streaming semantics that the rewrite must
preserve.

Add a make test-vps-live target that rehearses the proxy against the
real DeepSeek API: it starts the built proxy pointed at the real
upstream, reads the API key from the per-user runtime cache
(/run/user/$(id -u)/claude-apikey) and sends one streaming and one
non-streaming request.  Verified live: both requests return HTTP 200
with real completions and the full event trace.

Co-Authored-By: Claude <noreply@anthropic.com>
Makefile
conf/common/claude-proxy.scm