feat: complete TASK-WP0-02 contract baseline

This commit is contained in:
suyx
2026-07-27 17:49:24 +08:00
parent ae20eaf01f
commit dbe3e73b91
28 changed files with 2540 additions and 23 deletions
+46
View File
@@ -0,0 +1,46 @@
// Generated from openapi/openapi.json. Do not edit by hand.
export interface ClientOptions { baseUrl?: string; fetch?: typeof globalThis.fetch; headers?: HeadersInit; }
export async function getBootstrap(options: ClientOptions = {}): Promise<{
"app_version": string;
"dependencies": Array<{
"service_id": string;
"status": "available" | "paused" | "degraded" | "unavailable";
}>;
"model_summary": {
"config_set_version": number | null;
"configured_default_model_id": string | null;
"recommended_model_id": string | null;
"runtime_availability_version": number | null;
};
"public_features": Array<{
"feature_id": string;
"status": "enabled" | "disabled" | "paused";
}>;
}> {
const request = options.fetch ?? globalThis.fetch;
const response = await request(`${options.baseUrl ?? ""}/api/v1/bootstrap`, { method: "GET", headers: options.headers ?? {} });
if (!response.ok) throw new Error(`HTTP ${response.status}`);
return response.json() as Promise<{
"app_version": string;
"dependencies": Array<{
"service_id": string;
"status": "available" | "paused" | "degraded" | "unavailable";
}>;
"model_summary": {
"config_set_version": number | null;
"configured_default_model_id": string | null;
"recommended_model_id": string | null;
"runtime_availability_version": number | null;
};
"public_features": Array<{
"feature_id": string;
"status": "enabled" | "disabled" | "paused";
}>;
}>;
}
export function getEvents(options: Pick<ClientOptions, "baseUrl"> = {}): string {
return `${options.baseUrl ?? ""}/api/v1/events`;
}