mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-05 23:02:10 +03:00
* chore(release): v3.7.4 — version bump, openapi and changelog sync * fix: preserve previous_response_id and conversation_id fields on empty input array (#1729) * fix: bypass UI validation block for optional API keys and fix string fallback typing (#1721) * fix(proxy): disable HTTP keep-alive and pipelining in Undici proxy dispatcher to prevent socket hang up * feat(proxy): implement bulk proxy import via pipe-delimited parser with update-or-create logic * docs: update changelog for v3.7.4 fixes and proxy features * test: update responses store expectations for empty input arrays * feat(pwa): add fullscreen installable PWA with manifest, service worker, and cross-platform app icons. (#1728) Integrated into release/v3.7.4 * Fix image provider validation and Stability image requests (#1726) Integrated into release/v3.7.4 * docs: add PR 1726 and PR 1728 to v3.7.4 changelog * fix(security): replace insecure Math.random with crypto.getRandomValues for fallback UUID generation * fix(migrations): intercept 007 migration to use IF NOT EXISTS logic on fresh installs Fixes #1733 * test: fix typescript compilation errors in unit tests * fix(db): reconcile legacy reasoning cache migration * chore(release): bump to v3.7.4 — changelog, docs, version sync * fix(cc-compatible): preserve Claude Code system skeleton (#1740) Integrated into release/v3.7.4 * docs(changelog): update for PR #1740 merge * docs(changelog): include workflow updates * fix(db): reconcile legacy reasoning cache migration (#1734) Integrated into release/v3.7.4 * Add endpoint tunnel visibility settings (#1743) Integrated into release/v3.7.4 * Normalize max reasoning effort for Codex routing (#1744) Integrated into release/v3.7.4 * Fix Claude Code gateway config helper (#1745) Integrated into release/v3.7.4 * Refresh CLI fingerprint provider profiles (#1746) Integrated into release/v3.7.4 * Integrated into release/v3.7.4 (PR #1742) * docs(changelog): update for PRs 1742-1746 --------- Co-authored-by: diegosouzapw <diegosouzapw@users.noreply.github.com> Co-authored-by: Yash Ghule <y.ghule77@gmail.com> Co-authored-by: backryun <bakryun0718@proton.me> Co-authored-by: dhaern <manker_lol@hotmail.com> Co-authored-by: Randi <55005611+rdself@users.noreply.github.com> Co-authored-by: Duncan L <leungd@gmail.com>
93 lines
4.6 KiB
TypeScript
93 lines
4.6 KiB
TypeScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
|
|
import {
|
|
CURSOR_REGISTRY_VERSION,
|
|
GITHUB_COPILOT_API_VERSION,
|
|
GITHUB_COPILOT_CHAT_PLUGIN_VERSION,
|
|
GITHUB_COPILOT_CHAT_USER_AGENT,
|
|
GITHUB_COPILOT_EDITOR_VERSION,
|
|
GITHUB_COPILOT_REFRESH_PLUGIN_VERSION,
|
|
GITHUB_COPILOT_REFRESH_USER_AGENT,
|
|
KIRO_AMZ_USER_AGENT,
|
|
KIRO_SDK_USER_AGENT,
|
|
QWEN_CLI_VERSION,
|
|
getCursorUsageHeaders,
|
|
getQwenCliUserAgent,
|
|
getGitHubCopilotChatHeaders,
|
|
getGitHubCopilotInternalUserHeaders,
|
|
getGitHubCopilotRefreshHeaders,
|
|
getKiroServiceHeaders,
|
|
getQoderDashscopeCompatHeaders,
|
|
getQwenOauthHeaders,
|
|
} from "../../open-sse/config/providerHeaderProfiles.ts";
|
|
|
|
test("provider header profiles expose current GitHub chat and internal headers", () => {
|
|
const chatHeaders = getGitHubCopilotChatHeaders("text/event-stream", "agent");
|
|
assert.equal(chatHeaders["editor-version"], GITHUB_COPILOT_EDITOR_VERSION);
|
|
assert.equal(chatHeaders["editor-plugin-version"], GITHUB_COPILOT_CHAT_PLUGIN_VERSION);
|
|
assert.equal(chatHeaders["user-agent"], GITHUB_COPILOT_CHAT_USER_AGENT);
|
|
assert.equal(chatHeaders["x-github-api-version"], GITHUB_COPILOT_API_VERSION);
|
|
assert.equal(chatHeaders["X-Initiator"], "agent");
|
|
assert.equal(chatHeaders.Accept, "text/event-stream");
|
|
|
|
const internalHeaders = getGitHubCopilotInternalUserHeaders("token gh-access");
|
|
assert.equal(internalHeaders.Authorization, "token gh-access");
|
|
assert.equal(internalHeaders["User-Agent"], GITHUB_COPILOT_CHAT_USER_AGENT);
|
|
assert.equal(internalHeaders["Editor-Version"], GITHUB_COPILOT_EDITOR_VERSION);
|
|
assert.equal(internalHeaders["Editor-Plugin-Version"], GITHUB_COPILOT_CHAT_PLUGIN_VERSION);
|
|
assert.equal(internalHeaders["X-GitHub-Api-Version"], GITHUB_COPILOT_API_VERSION);
|
|
});
|
|
|
|
test("provider header profiles expose dedicated refresh, qwen, qoder, kiro and cursor variants", () => {
|
|
const refreshHeaders = getGitHubCopilotRefreshHeaders("token gh-access");
|
|
assert.equal(refreshHeaders.Authorization, "token gh-access");
|
|
assert.equal(refreshHeaders["User-Agent"], GITHUB_COPILOT_REFRESH_USER_AGENT);
|
|
assert.equal(refreshHeaders["Editor-Version"], GITHUB_COPILOT_EDITOR_VERSION);
|
|
assert.equal(refreshHeaders["Editor-Plugin-Version"], GITHUB_COPILOT_REFRESH_PLUGIN_VERSION);
|
|
|
|
const qwenHeaders = getQwenOauthHeaders();
|
|
assert.equal(qwenHeaders["User-Agent"], getQwenCliUserAgent());
|
|
assert.equal(qwenHeaders["User-Agent"], `QwenCode/${QWEN_CLI_VERSION} (${process.platform}; ${process.arch})`);
|
|
assert.notEqual(qwenHeaders["User-Agent"], "QwenCode/0.15.3 (linux; x64)");
|
|
assert.equal(qwenHeaders["X-Dashscope-UserAgent"], getQwenCliUserAgent());
|
|
assert.equal(qwenHeaders["X-Stainless-Package-Version"], "5.11.0");
|
|
assert.equal(qwenHeaders["X-Stainless-Runtime-Version"], process.version);
|
|
|
|
const qoderHeaders = getQoderDashscopeCompatHeaders();
|
|
assert.equal(qoderHeaders["user-agent"], getQwenCliUserAgent());
|
|
assert.equal(qoderHeaders["x-dashscope-useragent"], getQwenCliUserAgent());
|
|
|
|
const kiroHeaders = getKiroServiceHeaders("application/json");
|
|
assert.equal(kiroHeaders.Accept, "application/json");
|
|
assert.equal(kiroHeaders["User-Agent"], KIRO_SDK_USER_AGENT);
|
|
assert.equal(kiroHeaders["X-Amz-User-Agent"], KIRO_AMZ_USER_AGENT);
|
|
|
|
const cursorHeaders = getCursorUsageHeaders("cursor-token");
|
|
assert.equal(cursorHeaders.Authorization, "Bearer cursor-token");
|
|
assert.equal(cursorHeaders["User-Agent"], `Cursor/${CURSOR_REGISTRY_VERSION}`);
|
|
assert.equal(cursorHeaders["x-cursor-user-agent"], `Cursor/${CURSOR_REGISTRY_VERSION}`);
|
|
assert.equal(cursorHeaders["x-cursor-client-version"], CURSOR_REGISTRY_VERSION);
|
|
});
|
|
|
|
test("provider header profiles tolerate browser-like process shims", async () => {
|
|
const originalPlatform = process.platform;
|
|
const originalArch = process.arch;
|
|
const originalVersion = process.version;
|
|
|
|
Object.defineProperty(process, "platform", { value: undefined, configurable: true });
|
|
Object.defineProperty(process, "arch", { value: undefined, configurable: true });
|
|
Object.defineProperty(process, "version", { value: undefined, configurable: true });
|
|
|
|
try {
|
|
assert.equal(getQwenCliUserAgent(), `QwenCode/${QWEN_CLI_VERSION} (unknown; unknown)`);
|
|
const qwenHeaders = getQwenOauthHeaders();
|
|
assert.equal(qwenHeaders["User-Agent"], `QwenCode/${QWEN_CLI_VERSION} (unknown; unknown)`);
|
|
assert.equal(qwenHeaders["X-Stainless-Runtime-Version"], "unknown");
|
|
} finally {
|
|
Object.defineProperty(process, "platform", { value: originalPlatform, configurable: true });
|
|
Object.defineProperty(process, "arch", { value: originalArch, configurable: true });
|
|
Object.defineProperty(process, "version", { value: originalVersion, configurable: true });
|
|
}
|
|
});
|