Dashboard › opencode › Distillation
b03ebb43-ca4d-481d-95d7-af0cda93478b["lore_tm_v1_s9ye6ynzsRdzyT_JN1OTw01WZ7MoHEwxYOfkeHzQdv0","lore_tm_v1_WldsJyv_aDaCeacvB7dnM2NHW4mx84iQhfuU7dGF3pA","lore_tm_v1_x5h_vHxzTaTLOjbeWsJO85F8nB9T8N2F-70mUcIG9XU","lore_tm_v1_vgDcJ4VDZpJ3SSqWqb4ti6WVQ8tSALFu_GBFf62Hgd4"]
packages/core/test/fetch-interceptor-paths.test.ts contains 24 shouldIntercept() regression tests covering recognized Anthropic, OpenAI Chat, OpenAI Responses, aggregator, proxy, and Codex paths; negative non-LLM paths; localhost/gateway exclusions; and malformed-URL tolerance./v1/messages?beta=true, /v1/messages/foo, /v1/chat/completions?stream=true, /api/v1/chat/completions, /api/v1/messages, /api/v1/responses, /api/chat/completions, /api/messages, /openai/v1/chat/completions, /anthropic/v1/messages, and /codex/responses?foo=bar./codex/foo, /health, /v1/models, /v1/embeddings, and /api/foo/embeddings are not intercepted; /v1/models is metadata rather than an LLM request currently routed.shouldIntercept("not a url", GATEWAY) and shouldIntercept("", GATEWAY) return false without throwing.packages/core/test/fetch-interceptor-body.test.ts asserts ambiguous store and instructions fields are intentionally not OpenAI Responses markers because Chat Completions extensions may contain them; bodies with either field plus model and array-valued messages classify as "openai"."claude-sonnet-4-20250514" and verify both string and array forms of top-level system classify as "anthropic" when messages is an array; without system, the same model/messages shape classifies as "openai".null for {}, missing model, non-array messages, prompt-only { model: "gpt-4", prompt: "" }, invalid JSON, "null", and "[]".packages/core/test/fetch-interceptor-install.test.ts install installFetchInterceptor() over a stubbed globalThis.fetch, using gatewayBase: "http://127.0.0.1:3207" and dynamic headers "x-lore-session-id": "sess-123" and "x-lore-project": "/home/me/proj".authorization: "Bearer sk-test", direct-gateway authorization: "Bearer direct", and simultaneous "x-api-key": "primary-key" plus authorization: "Bearer secondary" remain unaltered.https://api.anthropic.com/v1/messages → ${GATEWAY}/v1/messages with upstream base https://api.anthropic.com; Codex https://chatgpt.com/backend-api/codex/responses → ${GATEWAY}/v1/codex/responses with upstream base https://chatgpt.com/backend-api; OpenRouter https://openrouter.ai/api/v1/chat/completions → ${GATEWAY}/v1/chat/completions with upstream base https://openrouter.ai/api./v2/chat/completions with OpenAI-shaped JSON → /v1/chat/completions and upstream base ending /v2; /llm/messages with Anthropic-shaped JSON → /v1/messages and upstream base ending /llm; /custom/responses with Responses-shaped JSON → /v1/responses and upstream base ending /custom; a Uint8Array-backed body is detectable.https://api.example.com/v2/chat/completions with a ReadableStream body must not become ${GATEWAY}/v1/chat/completions.https://api.example.com/v2/chat/completions remains on its original URL and receives no x-lore-upstream-url; https://registry.npmjs.org/some-package and http://localhost:8000/v1/messages likewise remain untouched.x-lore-upstream-path regression coverage for issue #1052 asserts exact values: GitHub Copilot → "/chat/completions"; standard OpenAI → "/v1/chat/completions"; OpenRouter aggregator → "/api/v1/chat/completions"; ChatGPT Codex → "/backend-api/codex/responses".interceptUrlForProtocol() tests assert OpenAI /v2/chat/completions maps to ${GATEWAY}/v1/chat/completions, upstream base https://api.example.com/v2, and upstream path /v2/chat/completions; Copilot preserves bare /chat/completions; Anthropic maps to /v1/messages; OpenAI Responses maps to /v1/responses; ?stream=true is preserved; an unknown /weird/path falls back to origin https://api.example.com.Request -> Request routing function because URL/header rewriting is currently hidden behind the process-global fetch installer; fail-first tests will exercise real routing cases, then both the legacy interceptor and V2 "http.request" hook will call this same function directly.