mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-15 03:32:21 +03:00
Release v3.7.6 (#1803)
* feat(api-keys): add rename support in permissions modal Add an editable key name field at the top of the permissions modal, allowing users to rename API keys alongside existing permission settings. The backend already supported name updates via PATCH /api/keys/:id — this wires the UI to send the name field and refreshes the key list on success. Changes: - Add keyName state and text input to PermissionsModal - Update handleUpdatePermissions to validate and send name in PATCH body - Add integration test for rename via PATCH (valid, empty, too-long names) - Update E2E mock to handle PATCH requests * chore(release): bump version to 3.7.6 * chore(release): v3.7.6 — merge API key rename feature and sync docs * chore(release): expand contributor credits to 155 PRs across full project history - Expanded acknowledgment table from 29 to 53 contributors - Added 100+ previously uncredited PRs from project inception through v3.7.5 - Moved contributor credits section to v3.7.6 (current release) - Synced llm.txt version to 3.7.6 * fix: resolve security ReDoS in codex and bugs #1797 #1789 * feat(dashboard): implement remaining v3.7.6 dashboard features and fixes * fix(xiaomi-mimo): update models to V2.5, fix Token Plan validation and default region (#1823) Integrated into release/v3.7.6 * fix(dashboard): correct loadPresets ReferenceError in CostOverviewTab * fix(codex): omit compact client metadata (#1822) Integrated into release/v3.7.6 * feat(chatgpt-web): support thinking_effort (Standard/Extended) for thinking-capable models (#1821) Integrated into release/v3.7.6 * Fix endpoint visibility, A2A status, and API catalog (#1806) Integrated into release/v3.7.6 * fix(analytics): use pure SQL aggregations — no history rows loaded (#1802) Integrated into release/v3.7.6 * fix(stability): resolve codex input validation, enable combo circuit breaker, and fix broken unit tests * docs(changelog): update for stability bug fixes #1804 #1805 * fix: clear active requests and recover providers (#1824) Integrated into release/v3.7.6 * feat: inject fallback tool names to prevent upstream 400 errors (#1775) * feat: auto-restore probe-failed database to prevent data loss (#1810) * fix: safely cast inputs to strings before calling trim() to avoid crashes on numeric fields in proxy modal (#1825) * chore(release): v3.7.6 — final stability patches for production * test: update expected db probe-failure error message for auto-restore feature * chore(workflow): mandate implementation plan generation in resolve-issues * docs(changelog): rewrite v3.7.6 with complete commit-accurate entries * feat(analytics): add cost-based usage insights and activity streaks Expand usage analytics to report total cost, per-series cost totals, API key counts, and current activity streaks using pricing-aware token calculations. Also make probe-failed database recovery choose the newest backup by its embedded timestamp instead of filesystem mtime so auto-restore selects the intended snapshot reliably. * fix(mitm): enforce transparent interception on port 443 only Reject non-443 MITM port updates in the settings API and normalize stored configuration back to the required transparent interception port. Lock the dashboard port field to 443, update the validation copy, and add integration coverage to prevent stale custom ports from being accepted or surfaced. * docs(changelog): update for analytics and mitm features --------- Co-authored-by: Andrew Munsell <andrew@wizardapps.net> Co-authored-by: Antigravity Assistant <bot@antigravity.local> Co-authored-by: Gi99lin <74502520+Gi99lin@users.noreply.github.com> Co-authored-by: Sergey Morozov <tr0st@bk.ru> Co-authored-by: payne <baboialex95@gmail.com> Co-authored-by: Randi <55005611+rdself@users.noreply.github.com> Co-authored-by: Paijo <14921983+oyi77@users.noreply.github.com> Co-authored-by: ipanghu <bypanghu@163.com>
This commit is contained in:
committed by
GitHub
parent
24ffdde03d
commit
3ec9ca11b1
@@ -123,16 +123,14 @@ export class CircuitBreaker {
|
||||
* @throws {Error} If circuit is OPEN
|
||||
*/
|
||||
async execute(fn) {
|
||||
this._refreshOpenState();
|
||||
|
||||
if (this.state === STATE.OPEN) {
|
||||
if (this._shouldAttemptReset()) {
|
||||
this._transition(STATE.HALF_OPEN);
|
||||
} else {
|
||||
throw new CircuitBreakerOpenError(
|
||||
`Circuit breaker "${this.name}" is OPEN. Try again later.`,
|
||||
this.name,
|
||||
this._timeUntilReset()
|
||||
);
|
||||
}
|
||||
throw new CircuitBreakerOpenError(
|
||||
`Circuit breaker "${this.name}" is OPEN. Try again later.`,
|
||||
this.name,
|
||||
this._timeUntilReset()
|
||||
);
|
||||
}
|
||||
|
||||
if (this.state === STATE.HALF_OPEN && this.halfOpenAllowed <= 0) {
|
||||
@@ -164,8 +162,10 @@ export class CircuitBreaker {
|
||||
* @returns {boolean}
|
||||
*/
|
||||
canExecute() {
|
||||
this._refreshOpenState();
|
||||
|
||||
if (this.state === STATE.CLOSED) return true;
|
||||
if (this.state === STATE.OPEN) return this._shouldAttemptReset();
|
||||
if (this.state === STATE.OPEN) return false;
|
||||
if (this.state === STATE.HALF_OPEN) return this.halfOpenAllowed > 0;
|
||||
return false;
|
||||
}
|
||||
@@ -175,6 +175,8 @@ export class CircuitBreaker {
|
||||
* @returns {{ name: string, state: string, failureCount: number, lastFailureTime: number|null }}
|
||||
*/
|
||||
getStatus() {
|
||||
this._refreshOpenState();
|
||||
|
||||
return {
|
||||
name: this.name,
|
||||
state: this.state,
|
||||
@@ -189,6 +191,8 @@ export class CircuitBreaker {
|
||||
* @returns {number}
|
||||
*/
|
||||
getRetryAfterMs() {
|
||||
this._refreshOpenState();
|
||||
|
||||
if (this.state === STATE.CLOSED) return 0;
|
||||
return this._timeUntilReset();
|
||||
}
|
||||
@@ -249,6 +253,13 @@ export class CircuitBreaker {
|
||||
return Math.max(0, this.resetTimeout - (Date.now() - this.lastFailureTime));
|
||||
}
|
||||
|
||||
_refreshOpenState() {
|
||||
if (this.state === STATE.OPEN && this._shouldAttemptReset()) {
|
||||
this._transition(STATE.HALF_OPEN);
|
||||
this._persistToDb();
|
||||
}
|
||||
}
|
||||
|
||||
_transition(newState) {
|
||||
const oldState = this.state;
|
||||
this.state = newState;
|
||||
|
||||
@@ -7,6 +7,10 @@
|
||||
* @module shared/utils/costEstimator
|
||||
*/
|
||||
|
||||
import { formatCost } from "./formatting";
|
||||
|
||||
export { formatCost };
|
||||
|
||||
/**
|
||||
* Default pricing per 1M tokens (fallback when no pricing config exists).
|
||||
* Values in USD.
|
||||
@@ -102,16 +106,6 @@ export function estimateCost({ model, inputTokens, maxOutputTokens = 1000, prici
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a cost value for display.
|
||||
* @param {number} usd
|
||||
* @returns {string}
|
||||
*/
|
||||
export function formatCost(usd) {
|
||||
if (usd < 0.01) return `$${(usd * 100).toFixed(4)}¢`;
|
||||
return `$${usd.toFixed(4)}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Quick pre-flight estimate: given a request body and model, return estimated cost.
|
||||
*
|
||||
|
||||
@@ -126,14 +126,21 @@ export function fmtFull(n) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a cost value with dollar sign.
|
||||
* @param {number} n - Cost value
|
||||
* Format a USD cost for display.
|
||||
* Sub-cent values show additional precision.
|
||||
* @param {number} usd - Cost in USD
|
||||
* @returns {string}
|
||||
*/
|
||||
export function fmtCost(n) {
|
||||
return `$${(n || 0).toFixed(2)}`;
|
||||
export function formatCost(usd: number | null | undefined): string {
|
||||
const value = Number(usd || 0);
|
||||
if (!Number.isFinite(value) || value === 0) return "$0.00";
|
||||
if (value < 0.01) return `$${value.toFixed(6)}`;
|
||||
if (value < 1) return `$${value.toFixed(4)}`;
|
||||
return `$${value.toFixed(2)}`;
|
||||
}
|
||||
|
||||
export const fmtCost = formatCost;
|
||||
|
||||
/**
|
||||
* Truncate a URL for compact display.
|
||||
* @param {string} url - Full URL
|
||||
|
||||
@@ -153,10 +153,11 @@ export function getTelemetrySummary(windowMs = 300000) {
|
||||
});
|
||||
|
||||
if (recent.length === 0) {
|
||||
return { count: 0, p50: 0, p95: 0, p99: 0, phaseBreakdown: {} };
|
||||
return { count: 0, avg: 0, p50: 0, p95: 0, p99: 0, phaseBreakdown: {} };
|
||||
}
|
||||
|
||||
const totals = recent.map((h) => h.totalMs).sort((a, b) => a - b);
|
||||
const avg = Math.round(totals.reduce((sum, value) => sum + value, 0) / totals.length);
|
||||
|
||||
// Phase breakdown
|
||||
const phaseBreakdown = {};
|
||||
@@ -177,6 +178,7 @@ export function getTelemetrySummary(windowMs = 300000) {
|
||||
|
||||
return {
|
||||
count: recent.length,
|
||||
avg,
|
||||
p50: percentile(totals, 50),
|
||||
p95: percentile(totals, 95),
|
||||
p99: percentile(totals, 99),
|
||||
|
||||
Reference in New Issue
Block a user