chore(style): codebase em-dash sweep + minor layout polish
Replaces every em-dash and en-dash with regular ASCII hyphens across comments, JSX strings, and dev-facing logs. Mostly cosmetic but stops the inconsistent mix that crept in over the last few months (some files used em-dashes in comments, others didn't, some used both). Bundles two small dashboard-layout tweaks that touch a couple of already-modified files: - (dashboard)/layout.tsx main padding goes from p-6 to pt-3 px-6 pb-6 so page content sits closer to the topbar. - Sidebar now receives the ports list it needs for the footer port switcher. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -20,7 +20,7 @@ import { logger } from '@/lib/logger';
|
||||
export type BudgetPeriod = 'day' | 'week' | 'month';
|
||||
|
||||
export interface AiBudget {
|
||||
/** When false, the budget is disabled — no caps enforced. */
|
||||
/** When false, the budget is disabled - no caps enforced. */
|
||||
enabled: boolean;
|
||||
softCapTokens: number;
|
||||
hardCapTokens: number;
|
||||
@@ -137,7 +137,7 @@ export async function checkBudget(args: {
|
||||
const { portId, estimatedTokens } = args;
|
||||
const budget = await readBudget(portId);
|
||||
if (!budget.enabled) {
|
||||
// Budget is off — usage still gets logged, but no caps enforced.
|
||||
// Budget is off - usage still gets logged, but no caps enforced.
|
||||
return { ok: true, remaining: Number.POSITIVE_INFINITY, usedTokens: 0, softCap: false };
|
||||
}
|
||||
const used = await currentPeriodTokens(portId);
|
||||
@@ -177,7 +177,7 @@ interface RecordUsageInput {
|
||||
requestId?: string | null;
|
||||
}
|
||||
|
||||
/** Insert a ledger row. Never throws — logged failures degrade silently. */
|
||||
/** Insert a ledger row. Never throws - logged failures degrade silently. */
|
||||
export async function recordAiUsage(input: RecordUsageInput): Promise<void> {
|
||||
try {
|
||||
const total = (input.inputTokens || 0) + (input.outputTokens || 0);
|
||||
@@ -193,13 +193,13 @@ export async function recordAiUsage(input: RecordUsageInput): Promise<void> {
|
||||
requestId: input.requestId ?? null,
|
||||
});
|
||||
} catch (err) {
|
||||
// Don't fail the user-facing call because the ledger write hiccuped —
|
||||
// Don't fail the user-facing call because the ledger write hiccuped -
|
||||
// we'd rather silently lose a row than blow up an OCR scan.
|
||||
logger.error({ err, feature: input.feature }, 'recordAiUsage failed');
|
||||
}
|
||||
}
|
||||
|
||||
/** Per-feature breakdown for the current period — feeds the admin dashboard. */
|
||||
/** Per-feature breakdown for the current period - feeds the admin dashboard. */
|
||||
export async function periodBreakdown(
|
||||
portId: string,
|
||||
): Promise<Array<{ feature: string; tokens: number; calls: number }>> {
|
||||
|
||||
Reference in New Issue
Block a user