mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-01 21:02:12 +03:00
* chore(release): open v3.8.15 development cycle Version bump 3.8.14 -> 3.8.15 (root + electron + open-sse + openapi + lockfiles) and seed the v3.8.15 changelog placeholder (root + 41 i18n mirrors). * fix(catalog): add getTokenLimit fallback for combo targets with unknown context (#3369) Integrated into release/v3.8.15. Fixes applied on the contributor's branch: removed duplicate JSDoc opening in accountFallback.ts and dropped a test asserting unreachable catalog behavior (models with no registry/spec/synced source are filtered before the getTokenLimit fallback at catalog.ts:499). * fix(combo): add 429 to PROVIDER_FAILURE_ERROR_CODES to prevent infinite retry loop (#3366) Integrated into release/v3.8.15. Comment block reconciled on the contributor's branch to remove the contradictory 'intentionally excluded' text that remained from the original code. * fix(auto-combo): include no-auth providers declaratively (#3365) Integrated into release/v3.8.15. Cleanup applied on contributor's branch: removed duplicate migration 095 (already exists from PR #3338), reverted CHANGELOG.md and i18n changelogs to release versions (release process owns these), dropped package version-bump noise from stale fork base. Core feature — declarative no-auth via serviceKinds metadata, declarative VEO as 'video' provider, anonymousFallback flag for opencode-zen/opencode-go — integrated cleanly. * fix(migrations): restore 095_provider_node_custom_headers migration The squash merge of PR #3365 accidentally deleted this migration because the cleanup commit on the contributor's branch included 'git rm' for the file (which was a duplicate on their branch). The migration was merged in v3.8.14 via PR #3338 and must be present in the release branch. Restoring from git history. * fix: update Command Code base URL from /alpha/ to /provider/v1/ (#3372) Integrated into release/v3.8.15. * feat(error-rules): provider-specific error classification with scope (#3370) Integrated into release/v3.8.15. PR has genuine value beyond #3369: (1) getProviderErrorRuleMatch now accepts native Headers objects from fetch(); (2) checkFallbackError also uses the provider rule registry — the real end-to-end wiring in the combo fallback path; (3) S4 end-to-end test proving the wiring fires. Merge commit on contributor branch resolved the add/add conflict by taking the #3370 version throughout. * fix(auto-combo): validate web-session credentials (#3371) Integrated into release/v3.8.15. Core feature: provider-aware web-session credential validation — hasUsableWebSessionCredential() replaces the broad Object.keys check in virtualFactory.ts, ensuring only sessions with the required storageKeys are included in auto-combo. Cleanup: removed duplicate 095 migration, reverted CHANGELOG/i18n, dropped package bump noise. * fix(migrations): restore 095_provider_node_custom_headers (deleted again by #3371 squash) Same issue as after #3365: git rm in the contributor cleanup commit was included in the squash, deleting this migration from release. Permanent fix needed: use 'git checkout origin/release -- <file>' instead of 'git rm' when cleaning up duplicate files in contributor branches. * fix(kiro): probe Windows %APPDATA%\kiro\storage.db in auto-import (#3363) (#3375) Integrated into release/v3.8.15. Test fix applied: kiro-windows-auto-import-3363.test.ts now sets DATA_DIR to a fresh temp dir before importing app modules, ensuring isAuthRequired() sees an empty settings DB (no password → auth not required). This fixed test 4 (synthetic SQLite) which was getting 401 due to settings DB state leakage. * chore(release): finalize v3.8.15 changelog — 2026-06-07 --------- Co-authored-by: Hernan Javier Ardila Sanchez <hjasgr@gmail.com> Co-authored-by: Paijo <14921983+oyi77@users.noreply.github.com> Co-authored-by: Muhammad Nabil Muyassar Rahman <65392758+TapZe@users.noreply.github.com> Co-authored-by: kiro-agent[bot] <245459735+kiro-agent[bot]@users.noreply.github.com>
64 lines
2.0 KiB
TypeScript
64 lines
2.0 KiB
TypeScript
/**
|
|
* Provider Schema Validation — Phase 7.2
|
|
*
|
|
* Zod schemas for provider constant validation.
|
|
* Validates provider category maps
|
|
* at module load time to catch configuration drift early.
|
|
*
|
|
* @module shared/validation/providerSchema
|
|
*/
|
|
|
|
import { z } from "zod";
|
|
|
|
const SERVICE_KIND_VALUES = [
|
|
"llm",
|
|
"embedding",
|
|
"image",
|
|
"imageToText",
|
|
"tts",
|
|
"stt",
|
|
"webSearch",
|
|
"webFetch",
|
|
"video",
|
|
"music",
|
|
] as const;
|
|
|
|
export const ProviderSchema = z.object({
|
|
id: z.string().min(1),
|
|
alias: z.string().min(1).optional(),
|
|
name: z.string().min(1),
|
|
icon: z.string().min(1),
|
|
color: z.string().regex(/^#[0-9A-Fa-f]{6}$/, "Must be a valid hex color (#RRGGBB)"),
|
|
textIcon: z.string().optional(),
|
|
website: z.string().url().optional(),
|
|
passthroughModels: z.boolean().optional(),
|
|
subscriptionRisk: z.boolean().optional(),
|
|
riskNoticeVariant: z.enum(["oauth", "webCookie", "deprecated", "embedded-service"]).optional(),
|
|
isEmbeddedService: z.boolean().optional(),
|
|
deprecated: z.boolean().optional(),
|
|
deprecationReason: z.string().optional(),
|
|
hasFree: z.boolean().optional(),
|
|
freeNote: z.string().optional(),
|
|
authHint: z.string().optional(),
|
|
apiHint: z.string().optional(),
|
|
serviceKinds: z.array(z.enum(SERVICE_KIND_VALUES)).optional(),
|
|
noAuth: z.boolean().optional(),
|
|
anonymousFallback: z.boolean().optional(),
|
|
});
|
|
|
|
export const ProvidersMapSchema = z.record(z.string(), ProviderSchema);
|
|
|
|
/**
|
|
* Validate a providers map, throwing a descriptive error on failure.
|
|
* @param {Record<string, object>} map - The providers map to validate
|
|
* @param {string} name - Name of the map for error messages
|
|
*/
|
|
export function validateProviders(map: Record<string, unknown>, name: string): void {
|
|
const result = ProvidersMapSchema.safeParse(map);
|
|
if (!result.success) {
|
|
const issues = result.error.issues.map((i) => ` ${i.path.join(".")}: ${i.message}`).join("\n");
|
|
console.error(`[PROVIDER VALIDATION] ${name} has invalid entries:\n${issues}`);
|
|
throw new Error(`Provider validation failed for ${name}`);
|
|
}
|
|
}
|