feat(server): OpenAI-compatible serve path for forged agents#22
Merged
Conversation
Add `forge-agent`: an executable that serves forge Agents behind a local OpenAI-compatible endpoint, so an existing host CLI (Codex, Grok Build) can point at it via OPENAI_BASE_URL and run "warm from prompt 1" — the Engine owns the loop and the agent's scaffold is the system prompt. - server/: http.Handler implementing GET /v1/models, POST /v1/chat/completions, and POST /v1/responses (Codex speaks the Responses API, not Chat Completions), both with SSE streaming. Translates OpenAI <-> forge messages. - Request-body decompression (zstd/gzip) via Content-Encoding + magic-byte sniffing — Codex ships the body zstd-compressed, which was the real failure. - Default-agent fallback: host GUIs send their own model ids (e.g. "gpt-5.5") that aren't agent names; unknown models resolve to a configured default agent instead of 404. - Request logging for live debuggability of host-CLI integration. - cmd/forge-agent: wires the north-star demo agents (vanilla_reviewer vs forged_reviewer) and serves them. - scripts/: serve.ps1 (launch) + demo.sh (curl driver). - Tests cover models/chat/responses, streaming, content-array + string inputs, zstd-encoded bodies, and the default-agent fallback. Validated live end-to-end through the real Codex CLI and GUI. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
forge-agent: an executable that serves forge Agents behind a local OpenAI-compatible endpoint, so an existing host CLI (Codex, Grok Build) can point at it via OPENAI_BASE_URL and run "warm from prompt 1" — the Engine owns the loop and the agent's scaffold is the system prompt.Validated live end-to-end through the real Codex CLI and GUI.