Repository navigation
fix(command-code): align CLI version header #3462
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -5,7 +5,7 @@ import { BaseExecutor, mergeUpstreamExtraHeaders, type ExecuteInput } from "./ba | |||||
|
|
||||||
| type JsonRecord = Record<string, unknown>; | ||||||
|
|
||||||
| const COMMAND_CODE_VERSION = "0.24.1"; | ||||||
| export const COMMAND_CODE_VERSION = process.env.COMMAND_CODE_VERSION?.trim() || "0.33.2"; | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. WARNING: The
Suggested change
|
||||||
| const MAX_COMMAND_CODE_TOKENS = 200_000; | ||||||
| const encoder = new TextEncoder(); | ||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -320,8 +320,7 @@ async function fetchWithProxyFallback( | |||||
| // Only attempt proxy fallback for retryable errors (network / timeout) | ||||||
| // and only when the target is not a local / LAN address. | ||||||
| const fetchErr = err as SafeOutboundFetchError; | ||||||
| const isNetworkIssue = | ||||||
| fetchErr?.code === "NETWORK_ERROR" || fetchErr?.code === "TIMEOUT"; | ||||||
| const isNetworkIssue = fetchErr?.code === "NETWORK_ERROR" || fetchErr?.code === "TIMEOUT"; | ||||||
| const isRetryable = fetchErr?.isRetryable !== false; | ||||||
| const isValidTarget = !isLocal && isRetryableProxyTarget(url); | ||||||
|
|
||||||
|
|
@@ -574,14 +573,15 @@ export async function validateCommandCodeProvider({ apiKey, providerSpecificData | |||||
| providerSpecificData?.validationModelId || | ||||||
| entry?.models?.find((model) => model.id === "deepseek/deepseek-v4-flash")?.id || | ||||||
| "deepseek/deepseek-v4-flash"; | ||||||
| const { COMMAND_CODE_VERSION } = await import("@omniroute/open-sse/executors/commandCode.ts"); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CRITICAL: Dynamic
Suggested change
should move to top-level import. Also, this dynamic import path uses @omniroute/open-sse alias but other imports in this file use relative paths like |
||||||
|
|
||||||
| return validateDirectChatProvider({ | ||||||
| url, | ||||||
| providerSpecificData, | ||||||
| headers: { | ||||||
| "Content-Type": "application/json", | ||||||
| Authorization: `Bearer ${apiKey}`, | ||||||
| "x-command-code-version": "0.24.1", | ||||||
| "x-command-code-version": COMMAND_CODE_VERSION, | ||||||
| "x-cli-environment": "external", | ||||||
| "x-project-slug": "pi-cc", | ||||||
| "x-taste-learning": "false", | ||||||
|
|
@@ -2914,8 +2914,7 @@ async function validateGrokWebProvider({ apiKey, providerSpecificData = {} }: an | |||||
| if (isCloudflareChallenge(errorDetail)) { | ||||||
| return { | ||||||
| valid: false, | ||||||
| error: | ||||||
| "Grok validation blocked by Cloudflare anti-bot. Try a residential IP or proxy.", | ||||||
| error: "Grok validation blocked by Cloudflare anti-bot. Try a residential IP or proxy.", | ||||||
| }; | ||||||
| } | ||||||
|
|
||||||
|
|
@@ -3410,9 +3409,8 @@ async function validateClaudeWebProvider({ apiKey, providerSpecificData = {} }: | |||||
| return { valid: false, error: "Paste your sessionKey cookie from claude.ai" }; | ||||||
| } | ||||||
|
|
||||||
| const { tlsFetchClaude, TlsClientUnavailableError } = await import( | ||||||
| "@omniroute/open-sse/services/claudeTlsClient.ts" | ||||||
| ); | ||||||
| const { tlsFetchClaude, TlsClientUnavailableError } = | ||||||
| await import("@omniroute/open-sse/services/claudeTlsClient.ts"); | ||||||
|
|
||||||
| let response: { status: number; text: string | null }; | ||||||
| try { | ||||||
|
|
@@ -3455,7 +3453,8 @@ async function validateClaudeWebProvider({ apiKey, providerSpecificData = {} }: | |||||
| if (response.status === 401 || response.status === 403) { | ||||||
| return { | ||||||
| valid: false, | ||||||
| error: "Invalid or expired session cookie — re-paste sessionKey from claude.ai DevTools → Cookies", | ||||||
| error: | ||||||
| "Invalid or expired session cookie — re-paste sessionKey from claude.ai DevTools → Cookies", | ||||||
| }; | ||||||
| } | ||||||
|
|
||||||
|
|
@@ -3502,7 +3501,8 @@ async function validateGeminiWebProvider({ apiKey, providerSpecificData = {} }: | |||||
| if (response.status === 401 || response.status === 403) { | ||||||
| return { | ||||||
| valid: false, | ||||||
| error: "Invalid or expired __Secure-1PSID cookie — re-paste from gemini.google.com DevTools → Cookies", | ||||||
| error: | ||||||
| "Invalid or expired __Secure-1PSID cookie — re-paste from gemini.google.com DevTools → Cookies", | ||||||
| }; | ||||||
| } | ||||||
|
|
||||||
|
|
@@ -3555,7 +3555,8 @@ async function validateCopilotWebProvider({ apiKey, providerSpecificData = {} }: | |||||
| if (response.status === 401 || response.status === 403) { | ||||||
| return { | ||||||
| valid: false, | ||||||
| error: "Invalid or expired access_token — re-paste from copilot.microsoft.com DevTools → Cookies", | ||||||
| error: | ||||||
| "Invalid or expired access_token — re-paste from copilot.microsoft.com DevTools → Cookies", | ||||||
| }; | ||||||
| } | ||||||
|
|
||||||
|
|
@@ -3774,15 +3775,10 @@ export async function validateProviderApiKey({ provider, apiKey, providerSpecifi | |||||
| * These providers share a POST /chat/completions auth check pattern and differ | ||||||
| * only in default baseUrl and test model name. | ||||||
| */ | ||||||
| function buildOpengatewayValidator( | ||||||
| defaultBaseUrl: string, | ||||||
| model: string | ||||||
| ) { | ||||||
| function buildOpengatewayValidator(defaultBaseUrl: string, model: string) { | ||||||
| return async ({ apiKey, providerSpecificData }: any) => { | ||||||
| try { | ||||||
| const baseUrl = normalizeBaseUrl( | ||||||
| providerSpecificData?.baseUrl || defaultBaseUrl | ||||||
| ); | ||||||
| const baseUrl = normalizeBaseUrl(providerSpecificData?.baseUrl || defaultBaseUrl); | ||||||
| const chatUrl = `${baseUrl.replace(/\/chat\/completions$/, "")}/chat/completions`; | ||||||
| const res = await validationWrite( | ||||||
| chatUrl, | ||||||
|
|
@@ -3832,8 +3828,7 @@ export async function validateProviderApiKey({ provider, apiKey, providerSpecifi | |||||
| // The executor routes these tokens to dashscope.aliyuncs.com, so the | ||||||
| // validation must test against dashscope, NOT the Cosy PAT endpoint. | ||||||
| try { | ||||||
| const dashscopeUrl = | ||||||
| "https://dashscope.aliyuncs.com/compatible-mode/v1/models"; | ||||||
| const dashscopeUrl = "https://dashscope.aliyuncs.com/compatible-mode/v1/models"; | ||||||
| const res = await validationRead( | ||||||
| dashscopeUrl, | ||||||
| { | ||||||
|
|
@@ -3994,7 +3989,7 @@ export async function validateProviderApiKey({ provider, apiKey, providerSpecifi | |||||
| max_tokens: 1, | ||||||
| }), | ||||||
| }, | ||||||
| isLocal, | ||||||
| isLocal | ||||||
| ); | ||||||
| if (res.status === 401 || res.status === 403) { | ||||||
| return { valid: false, error: "Invalid API key" }; | ||||||
|
|
@@ -4067,7 +4062,7 @@ export async function validateProviderApiKey({ provider, apiKey, providerSpecifi | |||||
| max_tokens: 1, | ||||||
| }), | ||||||
| }, | ||||||
| isLocal, | ||||||
| isLocal | ||||||
| ); | ||||||
| if (res.status === 401 || res.status === 403) { | ||||||
| return { valid: false, error: "Invalid API key" }; | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WARNING: Edge case with whitespace-only env var. If
process.env.COMMAND_CODE_VERSIONis set to whitespace (e.g.," "),?.trim()returns empty string which is falsy, correctly falling to default. However, the intent is clearer with explicit null check: