Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion open-sse/executors/commandCode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { BaseExecutor, mergeUpstreamExtraHeaders, type ExecuteInput } from "./ba

type JsonRecord = Record<string, unknown>;

const COMMAND_CODE_VERSION = "0.24.1";
const COMMAND_CODE_VERSION = process.env.COMMAND_CODE_VERSION?.trim() || "0.33.2";
Comment thread
hevener10 marked this conversation as resolved.
Resolved
Comment thread
hevener10 marked this conversation as resolved.
Resolved
const MAX_COMMAND_CODE_TOKENS = 200_000;
const encoder = new TextEncoder();

Expand Down
38 changes: 16 additions & 22 deletions src/lib/providers/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -581,7 +580,7 @@ export async function validateCommandCodeProvider({ apiKey, providerSpecificData
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${apiKey}`,
"x-command-code-version": "0.24.1",
"x-command-code-version": process.env.COMMAND_CODE_VERSION?.trim() || "0.33.2",
Comment thread
hevener10 marked this conversation as resolved.
Resolved
"x-cli-environment": "external",
"x-project-slug": "pi-cc",
"x-taste-learning": "false",
Expand Down Expand Up @@ -2914,8 +2913,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.",
};
}

Expand Down Expand Up @@ -3410,9 +3408,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 {
Expand Down Expand Up @@ -3455,7 +3452,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",
};
}

Expand Down Expand Up @@ -3502,7 +3500,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",
};
}

Expand Down Expand Up @@ -3555,7 +3554,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",
};
}

Expand Down Expand Up @@ -3774,15 +3774,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,
Expand Down Expand Up @@ -3832,8 +3827,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,
{
Expand Down Expand Up @@ -3994,7 +3988,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" };
Expand Down Expand Up @@ -4067,7 +4061,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" };
Expand Down