Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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 src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Import from "@/types" in any file.
*/

export type { ProviderConnection, ProviderNode, ModelCooldownErrorPayload } from "./provider";
export type { ModelCooldownErrorPayload } from "./provider";
export type { ApiKey } from "./apiKey";
export type { Combo, ComboStrategy, ComboNode } from "./combo";
export type { UsageEntry, UsageStats, ProviderUsageStats, ModelUsageStats, CallLog } from "./usage";
Expand Down
31 changes: 0 additions & 31 deletions src/types/provider.ts
Original file line number Diff line number Diff line change
@@ -1,34 +1,3 @@
/**
* Provider connection — a configured cloud AI provider account.
*/
export interface ProviderConnection {
id: string;
provider: string;
label: string;
url: string;
apiKey?: string;
oauthToken?: string;
oauthRefreshToken?: string;
oauthExpiresAt?: string;
isActive: boolean;
priority: number;
createdAt: string;
updatedAt: string;
}

/**
* Provider node — a specific endpoint within a provider.
*/
export interface ProviderNode {
id: string;
connectionId: string;
provider: string;
model: string;
baseUrl: string;
isActive: boolean;
priority: number;
}

export interface ModelCooldownErrorPayload {
error: {
message: string;
Expand Down
10 changes: 10 additions & 0 deletions tests/unit/error-message-sanitization.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ const mappingsRoute = await import("../../src/app/api/model-combo-mappings/route
const mappingsIdRoute = await import("../../src/app/api/model-combo-mappings/[id]/route.ts");
const syncTokens = await import("../../src/lib/sync/tokens.ts");

const repoRoot = path.resolve(import.meta.dirname, "../..");
const read = (relPath: string) => fs.readFileSync(path.join(repoRoot, relPath), "utf8");

function makeRequest(url: string, options: { method?: string; body?: unknown } = {}) {
const { method = "GET", body } = options;
return new Request(url, {
Expand Down Expand Up @@ -240,6 +243,13 @@ test("buildErrorBody never exposes stack traces in its message", async () => {
assert.ok(!body.error.message.includes("at /opt"));
});

test("types barrel keeps the model cooldown payload export only", async () => {
const src = await read("src/types/index.ts");
assert.match(src, /ModelCooldownErrorPayload/);
assert.doesNotMatch(src, /ProviderConnection/);
assert.doesNotMatch(src, /ProviderNode/);
});

// ── sanitizeUpstreamDetails ──────────────────────────────────────────────────

test("sanitizeUpstreamDetails — basic pass-through for safe fields", async () => {
Expand Down
Loading