feat: complete TASK-WP2-05 generation submission

This commit is contained in:
suyx
2026-08-03 00:26:34 +08:00
parent 4551d73e76
commit c8643c080d
22 changed files with 2372 additions and 22 deletions
@@ -0,0 +1,30 @@
export type GenerationSubmissionErrorCode =
| "generation_blocked"
| "generation_idempotency_conflict"
| "generation_not_found"
| "generation_request_invalid"
| "generation_storage_unavailable"
| "model_config_stale"
| "reference_invalid";
export class GenerationSubmissionError extends Error {
readonly code: GenerationSubmissionErrorCode;
readonly errorCategory: "gateway_balance_insufficient" | "gateway_contract_invalid" | "model_disabled" | "reference_invalid" | undefined;
readonly latest: { configVersion: number; creditCost: number; modelId: string } | undefined;
readonly storage: { capacityStatus: "normal" | "warning" | "critical" | "full" | "unavailable"; remainingBytes: number } | undefined;
constructor(
code: GenerationSubmissionErrorCode,
options: {
errorCategory?: "gateway_balance_insufficient" | "gateway_contract_invalid" | "model_disabled" | "reference_invalid";
latest?: { configVersion: number; creditCost: number; modelId: string };
storage?: { capacityStatus: "normal" | "warning" | "critical" | "full" | "unavailable"; remainingBytes: number };
} = {},
) {
super(code);
this.code = code;
this.errorCategory = options.errorCategory;
this.latest = options.latest;
this.storage = options.storage;
}
}